Start 0.11.x branch
[project/luci.git] / build / setup.lua
index 6b19c5330679af956d4a5d6bcc285c3c54616f49..f4ed76954817787878f139eb448bc4aec1391a11 100644 (file)
@@ -9,17 +9,38 @@ uci_model.cursor = function(config, save)
 end
 
 uci_model.cursor_state = function()
-       return uci_core.cursor(nil, SYSROOT .. "/var/state")
+       return uci_core.cursor(SYSROOT .. "/etc/config", 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
+uci_model.inst = uci_model.cursor()
+uci_model.inst_state = uci_model.cursor_state()
 
 -- allow any password in local sdk
 local sys = require "luci.sys"
 sys.user.checkpasswd = function() return true end
+sys.user.getpasswd   = function() return "x"  end
+
+-- dummy sysinfo on Darwin
+require "nixio"
+
+if not nixio.sysinfo then
+       function nixio.sysinfo()
+               return {
+                       bufferram = 0,
+                       freehigh = 0,
+                       freeram = 0,
+                       freeswap = 0,
+                       loads = { 0.0, 0.0, 0.0 },
+                       mem_unit = 1024,
+                       procs = 0,
+                       sharedram = 0,
+                       totalhigh = 0
+               }
+       end
+end
+
+-- override nixio.fs.access() to check sysroot first
+local _access = nixio.fs.access
+function nixio.fs.access(file)
+       return _access(SYSROOT .. "/" .. file) or _access(file)
+end