Skip to content
Snippets Groups Projects
Unverified Commit 42335a07 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

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.
parent 16fab561
No related branches found
No related tags found
No related merge requests found
......@@ -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
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"
......
......@@ -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
end
local function reconfigure()
if domain_changed then
os.execute('gluon-reconfigure')
end
uci:set('gluon', 'core', 'domain', data)
uci:save('gluon')
end
return {'gluon', reconfigure}
end
......@@ -100,5 +100,7 @@ return function(form, uci)
end
end
return {'gluon-node-info'}
function s:write()
uci:save("gluon-node-info")
end
end
......@@ -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
......@@ -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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment