diff --git a/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua b/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua index a47b6043..357d966e 100644 --- a/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua +++ b/package/gluon-config-mode-contact-info/luasrc/lib/gluon/config-mode/wizard/0500-contact-info.lua @@ -21,7 +21,6 @@ return function(form, uci) o.optional = true function o:write(data) uci:set("gluon-node-info", owner, "contact", data) + uci:save("gluon-node-info") end - - return {'gluon-node-info'} end diff --git a/package/gluon-config-mode-core/luasrc/lib/gluon/config-mode/model/gluon-config-mode/wizard.lua b/package/gluon-config-mode-core/luasrc/lib/gluon/config-mode/model/gluon-config-mode/wizard.lua index d32b56ac..882b61d9 100644 --- a/package/gluon-config-mode-core/luasrc/lib/gluon/config-mode/model/gluon-config-mode/wizard.lua +++ b/package/gluon-config-mode-core/luasrc/lib/gluon/config-mode/model/gluon-config-mode/wizard.lua @@ -1,15 +1,6 @@ local util = require "gluon.util" local uci = require("simple-uci").cursor() - -local wizard = {} -for _, entry in ipairs(util.glob('/lib/gluon/config-mode/wizard/*')) do - local f = assert(loadfile(entry)) - setfenv(f, getfenv()) - local w = f() - table.insert(wizard, w) -end - local f = Form(translate("Welcome!")) f.submit = translate('Save & restart') f.reset = false @@ -18,21 +9,10 @@ local s = f:section(Section) s.template = "wizard/welcome" s.package = "gluon-config-mode-core" -local commit = {'gluon-setup-mode'} -local run = {} - -for _, w in ipairs(wizard) do - for _, c in ipairs(w(f, uci) or {}) do - if type(c) == 'string' then - if not util.contains(commit, c) then - table.insert(commit, c) - end - elseif type(c) == 'function' then - table.insert(run, c) - else - error('invalid wizard module return') - end - end +for _, entry in ipairs(util.glob('/lib/gluon/config-mode/wizard/*')) do + local section = assert(loadfile(entry)) + setfenv(section, getfenv()) + section()(f, uci) end function f:write() @@ -41,12 +21,7 @@ function f:write() uci:set("gluon-setup-mode", uci:get_first("gluon-setup-mode", "setup_mode"), "configured", true) - for _, c in ipairs(commit) do - uci:commit(c) - end - for _, r in ipairs(run) do - r() - end + os.execute('gluon-reconfigure') f.template = "wizard/reboot" f.package = "gluon-config-mode-core" diff --git a/package/gluon-config-mode-domain-select/luasrc/lib/gluon/config-mode/wizard/0200-domain-select.lua b/package/gluon-config-mode-domain-select/luasrc/lib/gluon/config-mode/wizard/0200-domain-select.lua index 14ba4c63..72c3529e 100644 --- a/package/gluon-config-mode-domain-select/luasrc/lib/gluon/config-mode/wizard/0200-domain-select.lua +++ b/package/gluon-config-mode-domain-select/luasrc/lib/gluon/config-mode/wizard/0200-domain-select.lua @@ -49,20 +49,8 @@ return function(form, uci) o:value(domain.domain_code, domain.domain_name) end - local domain_changed = false - function o:write(data) - if data ~= selected_domain then - domain_changed = true - uci:set('gluon', 'core', 'domain', data) - end + uci:set('gluon', 'core', 'domain', data) + uci:save('gluon') end - - local function reconfigure() - if domain_changed then - os.execute('gluon-reconfigure') - end - end - - return {'gluon', reconfigure} end diff --git a/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua b/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua index 04ebf63a..5287e4fb 100644 --- a/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua +++ b/package/gluon-config-mode-geo-location/luasrc/lib/gluon/config-mode/wizard/0400-geo-location.lua @@ -100,5 +100,7 @@ return function(form, uci) end end - return {'gluon-node-info'} + function s:write() + uci:save("gluon-node-info") + end end diff --git a/package/gluon-config-mode-hostname/luasrc/lib/gluon/config-mode/wizard/0100-hostname.lua b/package/gluon-config-mode-hostname/luasrc/lib/gluon/config-mode/wizard/0100-hostname.lua index 1c9a0af3..5f31dd8f 100644 --- a/package/gluon-config-mode-hostname/luasrc/lib/gluon/config-mode/wizard/0100-hostname.lua +++ b/package/gluon-config-mode-hostname/luasrc/lib/gluon/config-mode/wizard/0100-hostname.lua @@ -30,7 +30,6 @@ return function(form, uci) function o:write(data) pretty_hostname.set(uci, data or default_hostname) + uci:save('system') end - - return {'system'} end diff --git a/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua b/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua index 6fca9d08..70a1307b 100644 --- a/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua +++ b/package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua @@ -60,8 +60,5 @@ return function(form, uci) function s:write() uci:save('gluon') - os.execute('exec /lib/gluon/mesh-vpn/update-config') end - - return {'gluon', 'fastd', 'tunneldigger', 'simple-tc'} end diff --git a/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua b/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua index 6a653df8..2fbc0fba 100644 --- a/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua +++ b/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua @@ -44,10 +44,6 @@ return function(form, uci) end uci:save('wireless') end - - os.execute('/lib/gluon/upgrade/200-wireless') end end - - return {'gluon', 'network', 'wireless'} end