Save if the config mode has ever been run, disable when not specifically enabled
This commit is contained in:
parent
73039fe51b
commit
c4be80c79e
|
@ -1,5 +1,6 @@
|
||||||
config wizard
|
config wizard
|
||||||
option enabled '1'
|
option enabled '1'
|
||||||
|
option configured '0'
|
||||||
|
|
||||||
config bandwidth
|
config bandwidth
|
||||||
option upstream '0'
|
option upstream '0'
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
module("luci.controller.ffhl.index", package.seeall)
|
module("luci.controller.ffhl.index", package.seeall)
|
||||||
|
|
||||||
function index()
|
|
||||||
local uci = luci.model.uci.cursor()
|
|
||||||
|
|
||||||
if uci:get_first("ffhl", "wizard", "enabled") == "1" then
|
function index()
|
||||||
|
local uci_state = luci.model.uci.cursor_state()
|
||||||
|
|
||||||
|
if uci_state:get_first("ffhl", "wizard", "running", "0") == "1" then
|
||||||
local root = node()
|
local root = node()
|
||||||
if not root.target then
|
if not root.target then
|
||||||
root.target = alias("wizard", "welcome")
|
root.target = alias("wizard", "welcome")
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
module("luci.controller.ffhl.wizard", package.seeall)
|
module("luci.controller.ffhl.wizard", package.seeall)
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
local uci = luci.model.uci.cursor()
|
local uci_state = luci.model.uci.cursor_state()
|
||||||
if uci:get_first("ffhl", "wizard", "enabled") == "1" then
|
if uci_state:get_first("ffhl", "wizard", "running", "0") == "1" then
|
||||||
entry({"wizard", "welcome"}, template("ffhl-wizard/welcome"), "Willkommen", 10).dependent=false
|
entry({"wizard", "welcome"}, template("ffhl-wizard/welcome"), "Willkommen", 10).dependent=false
|
||||||
entry({"wizard", "password"}, form("ffhl-wizard/password"), "Passwort", 20).dependent=false
|
entry({"wizard", "password"}, form("ffhl-wizard/password"), "Passwort", 20).dependent=false
|
||||||
entry({"wizard", "hostname"}, form("ffhl-wizard/hostname"), "Hostname", 30).dependent=false
|
entry({"wizard", "hostname"}, form("ffhl-wizard/hostname"), "Hostname", 30).dependent=false
|
||||||
|
@ -16,10 +16,11 @@ end
|
||||||
function reboot()
|
function reboot()
|
||||||
local uci = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
|
|
||||||
uci:foreach("ffhl", "wizard", function(s)
|
uci:foreach("ffhl", "wizard",
|
||||||
uci:set("ffhl", s[".name"], "enabled", "0")
|
function(s)
|
||||||
end
|
uci:set("ffhl", s[".name"], "configured", "1")
|
||||||
)
|
end
|
||||||
|
)
|
||||||
|
|
||||||
uci:save("ffhl")
|
uci:save("ffhl")
|
||||||
uci:commit("ffhl")
|
uci:commit("ffhl")
|
||||||
|
|
Loading…
Reference in New Issue