contrib/meshwizard: Add lan config, rework wan config
[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 -- allow any password in local sdk
19 local sys = require "luci.sys"
20 sys.user.checkpasswd = function() return true end
21
22 -- dummy sysinfo on Darwin
23 require "nixio"
24
25 if not nixio.sysinfo then
26 function nixio.sysinfo()
27 return {
28 bufferram = 0,
29 freehigh = 0,
30 freeram = 0,
31 freeswap = 0,
32 loads = { 0.0, 0.0, 0.0 },
33 mem_unit = 1024,
34 procs = 0,
35 sharedram = 0,
36 totalhigh = 0
37 }
38 end
39 end