gluon-config-mode-core: unconditionally run gluon-reconfigure
Simplify the individual form providers by always running reconfigure. This also commits all UCI packages, so we can remove all tracking of UCI sections from the wizard code. Instead of returning a list of packages to commit, the providers just save their settings directly. Explicit runs of upgrade scripts are removed, as they are now run by reconfigure.
This commit is contained in:
parent
16fab561db
commit
42335a07c9
@ -21,7 +21,6 @@ return function(form, uci)
|
|||||||
o.optional = true
|
o.optional = true
|
||||||
function o:write(data)
|
function o:write(data)
|
||||||
uci:set("gluon-node-info", owner, "contact", data)
|
uci:set("gluon-node-info", owner, "contact", data)
|
||||||
|
uci:save("gluon-node-info")
|
||||||
end
|
end
|
||||||
|
|
||||||
return {'gluon-node-info'}
|
|
||||||
end
|
end
|
||||||
|
@ -1,15 +1,6 @@
|
|||||||
local util = require "gluon.util"
|
local util = require "gluon.util"
|
||||||
local uci = require("simple-uci").cursor()
|
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!"))
|
local f = Form(translate("Welcome!"))
|
||||||
f.submit = translate('Save & restart')
|
f.submit = translate('Save & restart')
|
||||||
f.reset = false
|
f.reset = false
|
||||||
@ -18,21 +9,10 @@ local s = f:section(Section)
|
|||||||
s.template = "wizard/welcome"
|
s.template = "wizard/welcome"
|
||||||
s.package = "gluon-config-mode-core"
|
s.package = "gluon-config-mode-core"
|
||||||
|
|
||||||
local commit = {'gluon-setup-mode'}
|
for _, entry in ipairs(util.glob('/lib/gluon/config-mode/wizard/*')) do
|
||||||
local run = {}
|
local section = assert(loadfile(entry))
|
||||||
|
setfenv(section, getfenv())
|
||||||
for _, w in ipairs(wizard) do
|
section()(f, uci)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function f:write()
|
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)
|
uci:set("gluon-setup-mode", uci:get_first("gluon-setup-mode", "setup_mode"), "configured", true)
|
||||||
|
|
||||||
for _, c in ipairs(commit) do
|
os.execute('gluon-reconfigure')
|
||||||
uci:commit(c)
|
|
||||||
end
|
|
||||||
for _, r in ipairs(run) do
|
|
||||||
r()
|
|
||||||
end
|
|
||||||
|
|
||||||
f.template = "wizard/reboot"
|
f.template = "wizard/reboot"
|
||||||
f.package = "gluon-config-mode-core"
|
f.package = "gluon-config-mode-core"
|
||||||
|
@ -49,20 +49,8 @@ return function(form, uci)
|
|||||||
o:value(domain.domain_code, domain.domain_name)
|
o:value(domain.domain_code, domain.domain_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
local domain_changed = false
|
|
||||||
|
|
||||||
function o:write(data)
|
function o:write(data)
|
||||||
if data ~= selected_domain then
|
|
||||||
domain_changed = true
|
|
||||||
uci:set('gluon', 'core', 'domain', data)
|
uci:set('gluon', 'core', 'domain', data)
|
||||||
|
uci:save('gluon')
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local function reconfigure()
|
|
||||||
if domain_changed then
|
|
||||||
os.execute('gluon-reconfigure')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return {'gluon', reconfigure}
|
|
||||||
end
|
end
|
||||||
|
@ -100,5 +100,7 @@ return function(form, uci)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {'gluon-node-info'}
|
function s:write()
|
||||||
|
uci:save("gluon-node-info")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -30,7 +30,6 @@ return function(form, uci)
|
|||||||
|
|
||||||
function o:write(data)
|
function o:write(data)
|
||||||
pretty_hostname.set(uci, data or default_hostname)
|
pretty_hostname.set(uci, data or default_hostname)
|
||||||
|
uci:save('system')
|
||||||
end
|
end
|
||||||
|
|
||||||
return {'system'}
|
|
||||||
end
|
end
|
||||||
|
@ -60,8 +60,5 @@ return function(form, uci)
|
|||||||
|
|
||||||
function s:write()
|
function s:write()
|
||||||
uci:save('gluon')
|
uci:save('gluon')
|
||||||
os.execute('exec /lib/gluon/mesh-vpn/update-config')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {'gluon', 'fastd', 'tunneldigger', 'simple-tc'}
|
|
||||||
end
|
end
|
||||||
|
@ -44,10 +44,6 @@ return function(form, uci)
|
|||||||
end
|
end
|
||||||
uci:save('wireless')
|
uci:save('wireless')
|
||||||
end
|
end
|
||||||
|
|
||||||
os.execute('/lib/gluon/upgrade/200-wireless')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {'gluon', 'network', 'wireless'}
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user