diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-13 00:33:46 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-08-13 00:33:46 +0000 |
commit | 6dffa9ea56317a4bb6ecf58fd00b9fcd513cfa93 (patch) | |
tree | b3fa5aa00bf6dca7f9dafadfedba6be77a54c28b /build/setup.lua | |
parent | e795b1b2048a3e0b4b5ad9f72724a2b508ed54c5 (diff) |
build/setup.lua: override luci.model.uci.cursor_state() and clean up code
Diffstat (limited to 'build/setup.lua')
-rw-r--r-- | build/setup.lua | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/build/setup.lua b/build/setup.lua index a3e64f3d1..6b19c5330 100644 --- a/build/setup.lua +++ b/build/setup.lua @@ -1,13 +1,25 @@ - local SYSROOT = os.getenv("LUCI_SYSROOT") - require "uci" - require "luci.model.uci".cursor = function(config, save) - return uci.cursor(config or SYSROOT .. "/etc/config", save or SYSROOT .. "/tmp/.uci") - end - - local x = require "luci.uvl".UVL.__init__ - require "luci.uvl".UVL.__init__ = function(self, schemedir) - x(self, schemedir or SYSROOT .. "/lib/uci/schema") - end - - local sys = require "luci.sys" - sys.user.checkpasswd = function() return true end +local SYSROOT = os.getenv("LUCI_SYSROOT") + +-- override uci access +local uci_core = require "uci" +local uci_model = require "luci.model.uci" + +uci_model.cursor = function(config, save) + return uci_core.cursor(config or SYSROOT .. "/etc/config", save or SYSROOT .. "/tmp/.uci") +end + +uci_model.cursor_state = function() + return uci_core.cursor(nil, SYSROOT .. "/var/state") +end + +-- override uvl access +local uvl_model = require "luci.uvl" +local uvl_init = uvl_model.UVL.__init__ + +uvl_model.UVL.__init__ = function(self, schemedir) + uvl_init(self, schemedir or SYSROOT .. "/lib/uci/schema") +end + +-- allow any password in local sdk +local sys = require "luci.sys" +sys.user.checkpasswd = function() return true end |