build: adjust hostenv.sh for OS X
[project/luci.git] / build / setup.lua
1 local SYSROOT = os.getenv("LUCI_SYSROOT")
2
3 -- override uci access
4 local uci_core  = require "uci"
5 local uci_model = require "luci.model.uci"
6
7 uci_model.cursor = function(config, save)
8         return uci_core.cursor(config or SYSROOT .. "/etc/config", save or SYSROOT .. "/tmp/.uci")
9 end
10
11 uci_model.cursor_state = function()
12         return uci_core.cursor(SYSROOT .. "/etc/config", SYSROOT .. "/var/state")
13 end
14
15 uci_model.inst = uci_model.cursor()
16 uci_model.inst_state = uci_model.cursor_state()
17
18 -- override uvl access
19 local uvl_model = require "luci.uvl"
20 local uvl_init  = uvl_model.UVL.__init__
21
22 uvl_model.UVL.__init__ = function(self, schemedir)
23         uvl_init(self, schemedir or SYSROOT .. "/lib/uci/schema")
24 end
25
26 -- allow any password in local sdk
27 local sys = require "luci.sys"
28 sys.user.checkpasswd = function() return true end