treewide: use new gluon.site Lua library
Some files have received some additional refactoring.
This commit is contained in:
parent
fd36bcce07
commit
ee6afaced9
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local file = '/etc/dropbear/authorized_keys'
|
||||
|
||||
local keys = {}
|
||||
@ -14,7 +14,7 @@ end
|
||||
pcall(load_keys)
|
||||
|
||||
local f = io.open(file, 'a')
|
||||
for _, key in ipairs(site.authorized_keys) do
|
||||
for _, key in ipairs(site.authorized_keys()) do
|
||||
if not keys[key] then
|
||||
f:write(key .. '\n')
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
||||
|
||||
for name, config in pairs(site.autoupdater.branches) do
|
||||
for name, config in pairs(site.autoupdater.branches()) do
|
||||
uci:delete('autoupdater', name)
|
||||
uci:section('autoupdater', 'branch', name, {
|
||||
name = config.name,
|
||||
@ -16,7 +16,7 @@ end
|
||||
|
||||
if not uci:get('autoupdater', 'settings') then
|
||||
local enabled = false
|
||||
local branch = site.autoupdater.branch
|
||||
local branch = site.autoupdater.branch()
|
||||
|
||||
local f = io.open('/lib/gluon/autoupdater/default_branch')
|
||||
if f then
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local util = require 'gluon.util'
|
||||
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
@ -1,4 +1,4 @@
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local pretty_hostname = require 'pretty_hostname'
|
||||
|
||||
|
@ -2,14 +2,13 @@ local uci = require("simple-uci").cursor()
|
||||
local lutil = require "gluon.web.util"
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local util = require "gluon.util"
|
||||
|
||||
local pretty_hostname = require 'pretty_hostname'
|
||||
|
||||
|
||||
|
||||
local has_fastd = fs.access('/lib/gluon/mesh-vpn/fastd')
|
||||
local has_tunneldigger = fs.access('/lib/gluon/mesh-vpn/tunneldigger')
|
||||
|
||||
|
@ -10,7 +10,7 @@ end
|
||||
|
||||
local util = require 'gluon.util'
|
||||
local platform = require 'gluon.platform'
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
|
||||
local fs = require 'nixio.fs'
|
||||
local uci = require('simple-uci').cursor()
|
||||
@ -50,7 +50,7 @@ if wan_ifname and lan_ifname then
|
||||
sysconfig.lan_ifname = lan_ifname
|
||||
else
|
||||
local single_ifname = lan_ifname or wan_ifname
|
||||
if site.single_as_lan then
|
||||
if site.single_as_lan(false) then
|
||||
sysconfig.lan_ifname = single_ifname
|
||||
else
|
||||
sysconfig.wan_ifname = single_ifname
|
||||
|
@ -1,18 +1,21 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local pretty_hostname = require 'pretty_hostname'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
|
||||
-- Initial
|
||||
if not sysconfig.gluon_version then
|
||||
local site = require 'gluon.site_config'
|
||||
if sysconfig.gluon_version then
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
|
||||
local site = require 'gluon.site'
|
||||
local util = require 'gluon.util'
|
||||
local uci = require('simple-uci').cursor()
|
||||
local pretty_hostname = require 'pretty_hostname'
|
||||
|
||||
local system = uci:get_first('system', 'system')
|
||||
|
||||
pretty_hostname.set(uci, (site.hostname_prefix or '') .. util.node_id())
|
||||
uci:set('system', system, 'timezone', site.timezone)
|
||||
pretty_hostname.set(uci, site.hostname_prefix('') .. util.node_id())
|
||||
uci:set('system', system, 'timezone', site.timezone())
|
||||
|
||||
uci:save('system')
|
||||
end
|
||||
|
@ -1,13 +1,13 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require 'simple-uci'
|
||||
local site = require 'gluon.site'
|
||||
|
||||
if not site.ntp_servers or #site.ntp_servers == 0 then
|
||||
if #site.ntp_servers({}) == 0 then
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
local c = uci.cursor()
|
||||
c:delete('system', 'ntp', 'server')
|
||||
c:set_list('system', 'ntp', 'server', site.ntp_servers)
|
||||
c:save('system')
|
||||
|
||||
local uci = require('simple-uci').cursor()
|
||||
uci:delete('system', 'ntp', 'server')
|
||||
uci:set_list('system', 'ntp', 'server', site.ntp_servers({}))
|
||||
uci:save('system')
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
|
||||
if sysconfig.gluon_version or not site.poe_passthrough(false) then
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
|
||||
if (not sysconfig.gluon_version) and site.poe_passthrough then
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
||||
if uci:get('system', 'poe_passthrough') then
|
||||
uci:set('system', 'poe_passthrough', 'value', true)
|
||||
uci:save('system')
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
||||
local old_proto = uci:get('network', 'mesh_wan', 'proto')
|
||||
@ -12,7 +12,7 @@ uci:section('network', 'interface', 'mesh_wan', {
|
||||
})
|
||||
|
||||
if uci:get('network', 'mesh_wan', 'auto') == nil then
|
||||
uci:set('network', 'mesh_wan', 'auto', site.mesh_on_wan or false)
|
||||
uci:set('network', 'mesh_wan', 'auto', site.mesh_on_wan(false))
|
||||
end
|
||||
if uci:get('network', 'mesh_wan', 'transitive') == nil then
|
||||
uci:set('network', 'mesh_wan', 'transitive', true)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local util = require 'gluon.util'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
|
||||
@ -22,7 +22,7 @@ uci:section('network', 'interface', 'mesh_lan', {
|
||||
})
|
||||
|
||||
if uci:get('network', 'mesh_lan', 'auto') == nil then
|
||||
local enable = site.mesh_on_lan
|
||||
local enable = site.mesh_on_lan(false)
|
||||
|
||||
if enable then
|
||||
local interfaces = uci:get_list('network', 'client', 'ifname')
|
||||
@ -37,7 +37,7 @@ if uci:get('network', 'mesh_lan', 'auto') == nil then
|
||||
end
|
||||
end
|
||||
|
||||
uci:set('network', 'mesh_lan', 'auto', enable or false)
|
||||
uci:set('network', 'mesh_lan', 'auto', enable)
|
||||
end
|
||||
|
||||
if uci:get('network', 'mesh_lan', 'transitive') == nil then
|
||||
|
@ -1,7 +1,13 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local fs = require 'nixio.fs'
|
||||
local site = require 'gluon.site_config'
|
||||
|
||||
if not fs.access('/etc/opkg/distfeeds.conf') then
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
|
||||
local site = require 'gluon.site'
|
||||
local util = require 'gluon.util'
|
||||
|
||||
|
||||
@ -15,11 +21,14 @@ subst['%%S'] = f:read()
|
||||
subst['%%A'] = f:read()
|
||||
f:close()
|
||||
|
||||
subst['%%GS'] = site.site_code
|
||||
subst['%%GS'] = site.site_code()
|
||||
subst['%%GV'] = util.trim(fs.readfile('/lib/gluon/gluon-version'))
|
||||
subst['%%GR'] = util.trim(fs.readfile('/lib/gluon/release'))
|
||||
|
||||
function replace_patterns(url)
|
||||
local prefix = subst['%%n'] .. '_'
|
||||
|
||||
|
||||
local function replace_patterns(url)
|
||||
for k, v in pairs(subst) do
|
||||
url = url:gsub(k, v)
|
||||
end
|
||||
@ -28,9 +37,10 @@ function replace_patterns(url)
|
||||
end
|
||||
|
||||
|
||||
local prefix = subst['%%n'] .. '_'
|
||||
local lede = site.opkg.lede()
|
||||
local extra = site.opkg.extra({})
|
||||
|
||||
|
||||
if fs.access('/etc/opkg/distfeeds.conf') then
|
||||
local distfeeds = {}
|
||||
for line in io.lines('/etc/opkg/distfeeds.conf') do
|
||||
table.insert(distfeeds, line)
|
||||
@ -42,8 +52,8 @@ if fs.access('/etc/opkg/distfeeds.conf') then
|
||||
local name = line:match('^src/gz%s' .. prefix .. '(%S+)%s')
|
||||
if name == 'core' then
|
||||
f:write('# ' .. line .. '\n')
|
||||
elseif name and site.opkg and site.opkg.lede then
|
||||
f:write(string.format('src/gz %s %s/%s\n', prefix .. name, replace_patterns(site.opkg.lede), name))
|
||||
elseif name and lede then
|
||||
f:write(string.format('src/gz %s %s/%s\n', prefix .. name, replace_patterns(lede), name))
|
||||
else
|
||||
f:write(line .. '\n')
|
||||
end
|
||||
@ -51,10 +61,10 @@ if fs.access('/etc/opkg/distfeeds.conf') then
|
||||
|
||||
f:close()
|
||||
|
||||
if site.opkg and site.opkg.extra and next(site.opkg.extra) then
|
||||
if next(extra) then
|
||||
local f = io.open('/etc/opkg/gluon.conf', 'w')
|
||||
|
||||
for k, v in pairs(site.opkg.extra) do
|
||||
for k, v in pairs(extra) do
|
||||
f:write(string.format('src/gz %s %s\n', k, replace_patterns(v)))
|
||||
end
|
||||
|
||||
@ -63,4 +73,3 @@ if fs.access('/etc/opkg/distfeeds.conf') then
|
||||
else
|
||||
os.remove('/etc/opkg/gluon.conf')
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
prefix4 = require('gluon.site_config').prefix4
|
||||
local prefix4 = require('gluon.site').prefix4()
|
||||
|
||||
if prefix4 then
|
||||
rule('LOCAL_FORWARD -p ARP --arp-ip-src ' .. prefix4 .. ' --arp-ip-dst ' .. prefix4 .. ' -j RETURN')
|
||||
|
@ -1,4 +1,4 @@
|
||||
prefix4 = require('gluon.site_config').prefix4
|
||||
local prefix4 = require('gluon.site').prefix4()
|
||||
|
||||
if prefix4 then
|
||||
rule('LOCAL_FORWARD -p IPv4 --ip-protocol udp --ip-destination-port 67 -j RETURN')
|
||||
|
@ -12,7 +12,7 @@ start_service () {
|
||||
procd_set_param respawn ${respawn_threshold:-3660} ${respawn_timeout:-5} ${respawn_retry:-0}
|
||||
interfaces=$(for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device");do echo " -m $dev"; done;
|
||||
[ "$(ifstatus client | jsonfilter -e "@.up")" = "true" ] && echo " -i local-node")
|
||||
procd_set_param command "$PROG" -p $(lua -e 'print(require("gluon.site_config").prefix6)') $interfaces -t 11 -a $(uci get network.loopback.ip6addr | cut -d/ -f1) -4 0:0:0:0:0:ffff::/96
|
||||
procd_set_param command "$PROG" -p $(lua -e 'print(require("gluon.site").prefix6())') $interfaces -t 11 -a $(uci get network.loopback.ip6addr | cut -d/ -f1) -4 0:0:0:0:0:ffff::/96
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
@ -24,4 +24,3 @@ service_triggers() {
|
||||
procd_add_raw_trigger "interface.*" 0 "/etc/init.d/$name" reload
|
||||
procd_close_trigger
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local uci = require('simple-uci').cursor()
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
|
||||
uci:delete('network', 'l3roam')
|
||||
uci:section('network', 'interface', 'l3roam', {
|
||||
@ -12,7 +12,7 @@ uci:section('network', 'interface', 'l3roam', {
|
||||
uci:delete('network', 'l3roamd_client')
|
||||
uci:section('network', 'route6', 'l3roamd_client', {
|
||||
interface = 'l3roam',
|
||||
target = site.prefix6,
|
||||
target = site.prefix6(),
|
||||
gateway = '::',
|
||||
table = '10',
|
||||
})
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require "gluon.site_config"
|
||||
local site = require "gluon.site"
|
||||
|
||||
io.write("-i local-node -p " .. site.prefix6)
|
||||
io.write("-i local-node -p " .. site.prefix6())
|
||||
|
||||
if site.dns and site.dns.servers and site.next_node and site.next_node.ip6 then
|
||||
io.write(" --rdnss " .. site.next_node.ip6)
|
||||
if site.dns.servers() and site.next_node.ip6() then
|
||||
io.write(" --rdnss " .. site.next_node.ip6())
|
||||
end
|
||||
|
@ -1,20 +1,15 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local util = require 'gluon.util'
|
||||
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
||||
|
||||
local gw_mode, gw_sel_class, routing_algo
|
||||
|
||||
gw_mode = uci:get('batman-adv', 'bat0', 'gw_mode') or 'client'
|
||||
|
||||
if site.mesh and site.mesh.batman_adv then
|
||||
gw_sel_class = site.mesh.batman_adv.gw_sel_class
|
||||
routing_algo = site.mesh.batman_adv.routing_algo
|
||||
end
|
||||
local gw_mode = uci:get('batman-adv', 'bat0', 'gw_mode') or 'client'
|
||||
local gw_sel_class = site.mesh.batman_adv.gw_sel_class()
|
||||
local routing_algo = site.mesh.batman_adv.routing_algo()
|
||||
|
||||
|
||||
uci:delete('batman-adv', 'bat0')
|
||||
|
@ -4,7 +4,7 @@
|
||||
-- it overrides parts of network.client
|
||||
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local sysctl = require 'gluon.sysctl'
|
||||
|
||||
@ -15,7 +15,7 @@ uci:section('network', 'interface', 'client', {
|
||||
ipv6 = true,
|
||||
proto = 'dhcpv6',
|
||||
reqprefix = 'no',
|
||||
peerdns = not (site.dns and site.dns.servers),
|
||||
peerdns = not site.dns.servers(),
|
||||
sourcefilter = false,
|
||||
keep_ra_dnslifetime = true,
|
||||
robustness = 3,
|
||||
@ -28,7 +28,7 @@ uci:delete('network', 'client_lan')
|
||||
uci:delete('network', 'local_node_route6')
|
||||
uci:section('network', 'route6', 'local_node_route6', {
|
||||
interface = 'client',
|
||||
target = site.prefix6,
|
||||
target = site.prefix6(),
|
||||
gateway = '::',
|
||||
})
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local users = require 'gluon.users'
|
||||
local util = require 'gluon.util'
|
||||
local fs = require 'nixio.fs'
|
||||
@ -14,7 +14,7 @@ uci:section('network', 'interface', 'mesh_vpn', {
|
||||
transitive = true,
|
||||
fixed_mtu = true,
|
||||
macaddr = util.generate_mac(7),
|
||||
mtu = site.mesh_vpn.mtu,
|
||||
mtu = site.mesh_vpn.mtu(),
|
||||
})
|
||||
|
||||
uci:save('network')
|
||||
@ -25,22 +25,12 @@ if fs.access('/etc/config/gluon-simple-tc') then
|
||||
end
|
||||
|
||||
if not uci:get('simple-tc', 'mesh_vpn') then
|
||||
local config = {
|
||||
uci:section('simple-tc', 'interface', 'mesh_vpn', {
|
||||
ifname = 'mesh-vpn',
|
||||
enabled = false,
|
||||
}
|
||||
|
||||
|
||||
if site.mesh_vpn.bandwidth_limit then
|
||||
if site.mesh_vpn.bandwidth_limit.enabled then
|
||||
config.enabled = true
|
||||
end
|
||||
|
||||
config.limit_ingress = site.mesh_vpn.bandwidth_limit.ingress
|
||||
config.limit_egress = site.mesh_vpn.bandwidth_limit.egress
|
||||
end
|
||||
|
||||
uci:section('simple-tc', 'interface', 'mesh_vpn', config)
|
||||
enabled = site.mesh_vpn.bandwidth_limit.enabled(false),
|
||||
limit_ingress = site.mesh_vpn.bandwidth_limit.ingress(),
|
||||
limit_egress = site.mesh_vpn.bandwidth_limit.egress(),
|
||||
})
|
||||
uci:save('simple-tc')
|
||||
end
|
||||
|
||||
@ -79,7 +69,7 @@ elseif fastd_enabled or tunneldigger_enabled then
|
||||
enabled = fastd_enabled == '1' or tunneldigger_enabled == '1'
|
||||
-- If nothing is set, use the default
|
||||
else
|
||||
enabled = site.mesh_vpn.enabled or false
|
||||
enabled = site.mesh_vpn.enabled(false)
|
||||
end
|
||||
|
||||
if has_fastd then
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local util = require 'gluon.util'
|
||||
|
||||
local uci = require('simple-uci').cursor()
|
||||
@ -10,8 +10,8 @@ local syslog_level = uci:get('fastd', 'mesh_vpn', 'syslog_level') or 'verbose'
|
||||
|
||||
local methods
|
||||
|
||||
if site.mesh_vpn.fastd.configurable then
|
||||
local has_null = util.contains(site.mesh_vpn.fastd.methods, 'null')
|
||||
if site.mesh_vpn.fastd.configurable(false) then
|
||||
local has_null = util.contains(site.mesh_vpn.fastd.methods(), 'null')
|
||||
|
||||
local old_methods = uci:get('fastd', 'mesh_vpn', 'method')
|
||||
if old_methods then
|
||||
@ -23,14 +23,14 @@ if site.mesh_vpn.fastd.configurable then
|
||||
table.insert(methods, 'null')
|
||||
end
|
||||
|
||||
for _, method in ipairs(site.mesh_vpn.fastd.methods) do
|
||||
for _, method in ipairs(site.mesh_vpn.fastd.methods()) do
|
||||
if method ~= 'null' then
|
||||
table.insert(methods, method)
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
methods = site.mesh_vpn.fastd.methods
|
||||
methods = site.mesh_vpn.fastd.methods()
|
||||
end
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ uci:section('fastd', 'fastd', 'mesh_vpn', {
|
||||
syslog_level = syslog_level,
|
||||
interface = 'mesh-vpn',
|
||||
mode = 'tap',
|
||||
mtu = site.mesh_vpn.mtu,
|
||||
mtu = site.mesh_vpn.mtu(),
|
||||
secure_handshakes = true,
|
||||
method = methods,
|
||||
packet_mark = 1,
|
||||
@ -92,7 +92,7 @@ function add_groups(prefix, groups, parent)
|
||||
end
|
||||
end
|
||||
|
||||
add_groups('mesh_vpn', site.mesh_vpn.fastd.groups)
|
||||
add_groups('mesh_vpn', site.mesh_vpn.fastd.groups())
|
||||
|
||||
|
||||
uci:save('fastd')
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local util = require 'gluon.util'
|
||||
|
||||
local uci = require('simple-uci').cursor()
|
||||
@ -27,7 +27,7 @@ uci:section('tunneldigger', 'broker', 'mesh_vpn', {
|
||||
bind_interface = 'br-wan',
|
||||
group = 'gluon-mesh-vpn',
|
||||
broker_selection = 'usage',
|
||||
address = site.mesh_vpn.tunneldigger.brokers,
|
||||
address = site.mesh_vpn.tunneldigger.brokers(),
|
||||
})
|
||||
|
||||
uci:save('tunneldigger')
|
||||
|
@ -1,18 +1,12 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
||||
local config = 'gluon-node-info'
|
||||
local role = uci:get(config, uci:get_first(config, 'system'), 'role')
|
||||
|
||||
if site.roles then
|
||||
default_role = site.roles.default
|
||||
else
|
||||
default_role = ''
|
||||
end
|
||||
|
||||
if not role then
|
||||
uci:set(config, uci:get_first(config, 'system'), 'role', default_role)
|
||||
uci:set(config, uci:get_first(config, 'system'), 'role', site.roles.default(''))
|
||||
uci:save(config)
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ init_switch() {
|
||||
start_service() {
|
||||
prepare_config
|
||||
init_switch
|
||||
iw reg set "$(lua -e 'print(require("gluon.site_config").regdom)')"
|
||||
iw reg set "$(lua -e 'print(require("gluon.site").regdom())')"
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /sbin/netifd -c /var/gluon/setup-mode/config
|
||||
|
@ -1,14 +1,11 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local uci = require('simple-uci').cursor()
|
||||
|
||||
|
||||
if site.setup_mode
|
||||
and site.setup_mode.skip
|
||||
and not uci:get_first('gluon-setup-mode', 'setup_mode', 'configured', false) then
|
||||
if site.setup_mode.skip(false) and not uci:get_first('gluon-setup-mode', 'setup_mode', 'configured', false) then
|
||||
local name = uci:get_first("gluon-setup-mode", "setup_mode")
|
||||
uci:set("gluon-setup-mode", name, "configured", true)
|
||||
uci:save('gluon-setup-mode')
|
||||
end
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
local lutil = require 'gluon.web.util'
|
||||
local pretty_hostname = require 'pretty_hostname'
|
||||
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local sysconfig = require 'gluon.sysconfig'
|
||||
local platform = require 'gluon.platform'
|
||||
local util = require "gluon.util"
|
||||
@ -26,7 +26,7 @@
|
||||
model = platform.get_model(),
|
||||
version = util.trim(fs.readfile('/lib/gluon/gluon-version')),
|
||||
release = util.trim(fs.readfile('/lib/gluon/release')),
|
||||
site = site.site_name,
|
||||
site = site.site_name(),
|
||||
pubkey = 'n/a',
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,14 @@ else
|
||||
end
|
||||
|
||||
function mode:write(data)
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
|
||||
local methods = {}
|
||||
if data == 'performance' then
|
||||
table.insert(methods, 'null')
|
||||
end
|
||||
|
||||
for _, method in ipairs(site.mesh_vpn.fastd.methods) do
|
||||
for _, method in ipairs(site.mesh_vpn.fastd.methods()) do
|
||||
if method ~= 'null' then
|
||||
table.insert(methods, method)
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
local f, s, o
|
||||
local site = require 'gluon.site_config'
|
||||
local site = require 'gluon.site'
|
||||
local uci = require("simple-uci").cursor()
|
||||
local config = 'gluon-node-info'
|
||||
|
||||
@ -16,7 +16,7 @@ s = f:section(Section, nil, translate(
|
||||
|
||||
o = s:option(ListValue, "role", translate("Role"))
|
||||
o.default = role
|
||||
for _, role in ipairs(site.roles.list) do
|
||||
for _, role in ipairs(site.roles.list()) do
|
||||
o:value(role, translate('gluon-web-node-role:role:' .. role))
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user