31 lines
1.1 KiB
Lua
31 lines
1.1 KiB
Lua
module("luci.controller.ffhl.wizard", package.seeall)
|
|
|
|
function index()
|
|
local uci_state = luci.model.uci.cursor_state()
|
|
if uci_state:get_first("ffhl", "wizard", "running", "0") == "1" then
|
|
entry({"wizard", "welcome"}, template("ffhl-wizard/welcome"), "Willkommen", 10).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", "meshvpn"}, form("ffhl-wizard/meshvpn"), "Mesh-VPN", 40).dependent=false
|
|
entry({"wizard", "meshvpn", "pubkey"}, template("ffhl-wizard/meshvpn-key"), "Mesh-VPN Key", 1).dependent=false
|
|
entry({"wizard", "completed"}, template("ffhl-wizard/completed"), "Fertig", 50).dependent=false
|
|
entry({"wizard", "completed", "reboot"}, call("reboot"), "reboot", 1).dependent=false
|
|
end
|
|
end
|
|
|
|
function reboot()
|
|
local uci = luci.model.uci.cursor()
|
|
|
|
uci:foreach("ffhl", "wizard",
|
|
function(s)
|
|
uci:set("ffhl", s[".name"], "configured", "1")
|
|
end
|
|
)
|
|
|
|
uci:save("ffhl")
|
|
uci:commit("ffhl")
|
|
|
|
luci.sys.reboot()
|
|
end
|
|
|