diff options
-rw-r--r-- | contrib/package/luci-addons/dist/etc/init.d/luci_fixtime | 4 | ||||
-rw-r--r-- | libs/cbi/luasrc/cbi.lua | 4 | ||||
-rw-r--r-- | libs/core/luasrc/sys.lua | 8 | ||||
-rw-r--r-- | libs/core/luasrc/util.lua | 7 | ||||
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 2 | ||||
-rw-r--r-- | libs/web/luasrc/i18n.lua | 4 | ||||
-rw-r--r-- | libs/web/luasrc/template.lua | 5 |
7 files changed, 18 insertions, 16 deletions
diff --git a/contrib/package/luci-addons/dist/etc/init.d/luci_fixtime b/contrib/package/luci-addons/dist/etc/init.d/luci_fixtime index 3ca003887d..681d9d7898 100644 --- a/contrib/package/luci-addons/dist/etc/init.d/luci_fixtime +++ b/contrib/package/luci-addons/dist/etc/init.d/luci_fixtime @@ -3,9 +3,9 @@ START=05 start() { - cat <<' EOF' | lua -l luci.fs -l luci.sys - + cat <<' EOF' | lua -l luci.fs -l luci.util - if (os.time() < 1000000000) then - os.execute('date -s ' .. os.date('%m%d%H%M%Y', luci.fs.mtime(luci.sys.libpath()))) + os.execute('date -s ' .. os.date('%m%d%H%M%Y', luci.fs.mtime(luci.util.libpath()))) end EOF } diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index d5be48edba..f81f7f1b94 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -41,9 +41,9 @@ function load(cbimap) require("luci.fs") require("luci.i18n") require("luci.config") - require("luci.sys") + require("luci.util") - local cbidir = luci.sys.libpath() .. "/model/cbi/" + local cbidir = luci.util.libpath() .. "/model/cbi/" local func, err = loadfile(cbidir..cbimap..".lua") if not func then diff --git a/libs/core/luasrc/sys.lua b/libs/core/luasrc/sys.lua index c291f67896..14a2f294f3 100644 --- a/libs/core/luasrc/sys.lua +++ b/libs/core/luasrc/sys.lua @@ -24,7 +24,7 @@ limitations under the License. ]]-- ---- LuCI system utilities. +--- LuCI Linux and POSIX system utilities. module("luci.sys", package.seeall) require("posix") require("luci.bits") @@ -70,12 +70,6 @@ function httpget(url, stream) return source("wget -qO- '"..url:gsub("'", "").."'") end ---- Returns the absolute path to LuCI base directory. --- @return String containing the directory path -function libpath() - return luci.fs.dirname(require("luci.debug").__file__) -end - --- Returns the system load average values. -- @return String containing the average load value 1 minute ago -- @return String containing the average load value 5 minutes ago diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua index 2f6cfad4c2..cd3534f4f1 100644 --- a/libs/core/luasrc/util.lua +++ b/libs/core/luasrc/util.lua @@ -612,6 +612,13 @@ function execl(command) return data end +--- Returns the absolute path to LuCI base directory. +-- @return String containing the directory path +function libpath() + return luci.fs.dirname(require("luci.debug").__file__) +end + + -- -- Coroutine safe xpcall and pcall versions modified for Luci -- original version: diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 576db36b41..840dbf3c26 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -201,7 +201,7 @@ end --- Generate the dispatching index using the best possible strategy. function createindex() - local path = luci.sys.libpath() .. "/controller/" + local path = luci.util.libpath() .. "/controller/" local suff = ".lua" if luci.util.copcall(require, "luci.fastindex") then diff --git a/libs/web/luasrc/i18n.lua b/libs/web/luasrc/i18n.lua index 5f0ee8a011..84a8695397 100644 --- a/libs/web/luasrc/i18n.lua +++ b/libs/web/luasrc/i18n.lua @@ -26,10 +26,10 @@ limitations under the License. --- LuCI translation library. module("luci.i18n", package.seeall) -require("luci.sys") +require("luci.util") table = {} -i18ndir = luci.sys.libpath() .. "/i18n/" +i18ndir = luci.util.libpath() .. "/i18n/" loaded = {} context = luci.util.threadlocal() default = "en" diff --git a/libs/web/luasrc/template.lua b/libs/web/luasrc/template.lua index 659c7216d8..907403fcbb 100644 --- a/libs/web/luasrc/template.lua +++ b/libs/web/luasrc/template.lua @@ -30,12 +30,13 @@ module("luci.template", package.seeall) require("luci.config") require("luci.util") require("luci.fs") +require("luci.sys") require("luci.http") luci.config.template = luci.config.template or {} -viewdir = luci.config.template.viewdir or luci.sys.libpath() .. "/view" -compiledir = luci.config.template.compiledir or luci.sys.libpath() .. "/view" +viewdir = luci.config.template.viewdir or luci.util.libpath() .. "/view" +compiledir = luci.config.template.compiledir or luci.util.libpath() .. "/view" -- Compile modes: |