From: Steven Barth Date: Fri, 29 Aug 2008 17:06:58 +0000 (+0000) Subject: modules/rpc: Check for existence of external libraries X-Git-Tag: 0.8.0~250 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=a0650b4ca96a184887369e04bc4793579364aeef;ds=sidebyside modules/rpc: Check for existence of external libraries libs/sys: Small fix for API-Documentation --- diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua index 557a7ce54..d9f236e1b 100644 --- a/libs/sys/luasrc/sys.lua +++ b/libs/sys/luasrc/sys.lua @@ -207,6 +207,8 @@ end group = {} --- Returns information about a POSIX user group. +-- @class function +-- @name getgroup -- @param group Group ID or name of a system user group -- @return Table with information about the requested group group.getgroup = posix.getgroup diff --git a/modules/rpc/luasrc/controller/rpc.lua b/modules/rpc/luasrc/controller/rpc.lua index fdfbdb38e..b3ec32ce4 100644 --- a/modules/rpc/luasrc/controller/rpc.lua +++ b/modules/rpc/luasrc/controller/rpc.lua @@ -33,21 +33,25 @@ function index() luci.http.status(403, "Forbidden") end - uci = entry({"rpc", "uci"}, call("rpc_uci")) - uci.sysauth = "root" - uci.sysauth_authenticator = authenticator + if pcall(require, "luci.model.uci") then + uci = entry({"rpc", "uci"}, call("rpc_uci")) + uci.sysauth = "root" + uci.sysauth_authenticator = authenticator + end fs = entry({"rpc", "fs"}, call("rpc_fs")) fs.sysauth = "root" fs.sysauth_authenticator = authenticator - fs = entry({"rpc", "sys"}, call("rpc_sys")) - fs.sysauth = "root" - fs.sysauth_authenticator = authenticator + sys = entry({"rpc", "sys"}, call("rpc_sys")) + sys.sysauth = "root" + sys.sysauth_authenticator = authenticator - fs = entry({"rpc", "ipkg"}, call("rpc_ipkg")) - fs.sysauth = "root" - fs.sysauth_authenticator = authenticator + if pcall(require, "luci.model.ipkg") then + fs = entry({"rpc", "ipkg"}, call("rpc_ipkg")) + fs.sysauth = "root" + fs.sysauth_authenticator = authenticator + end uci = entry({"rpc", "auth"}, call("rpc_auth")) end