Skip to content
Snippets Groups Projects
Commit cf6c51ee authored by Nils Schneider's avatar Nils Schneider
Browse files

gluon-config-mode: rename configmode to config-mode (except in lua variables...

gluon-config-mode: rename configmode to config-mode (except in lua variables where it is still called configmode)
parent ae5277ff
No related branches found
No related tags found
No related merge requests found
Showing
with 102 additions and 25 deletions
......@@ -4,10 +4,10 @@
wait=3
wait_configmode() {
wait_config_mode() {
sleep $wait
uci set 'configmode.@wizard[0].enabled=1'
uci commit configmode
uci set 'config-mode.@wizard[0].enabled=1'
uci commit config-mode
reboot
}
......@@ -15,14 +15,14 @@ wait_configmode() {
if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then
case "$ACTION" in
pressed)
wait_configmode &
wait_config_mode &
PID=$!
echo $PID > /tmp/.wait_configmode
echo $PID > /tmp/.wait_config_mode
;;
released)
if [ -r /tmp/.wait_configmode ]; then
kill $(cat /tmp/.wait_configmode)
rm /tmp/.wait_configmode
if [ -r /tmp/.wait_config_mode ]; then
kill $(cat /tmp/.wait_config_mode)
rm /tmp/.wait_config_mode
fi
;;
esac
......
......@@ -3,12 +3,12 @@
START=12
configmode_iface=eth0
configmode_addr=192.168.1.1
configmode_plen=24
config_mode_iface=eth0
config_mode_addr=192.168.1.1
config_mode_plen=24
configmode_dnsname=freifunk
configmode_dhcp_range=192.168.1.2,192.168.1.254
config_mode_dnsname=freifunk
config_mode_dhcp_range=192.168.1.2,192.168.1.254
check_enable() {
config_get enabled "$1" enabled
......@@ -21,16 +21,16 @@ check_enable() {
start() {
enable=0
config_load configmode
config_load config-mode
config_foreach check_enable wizard
if [ "$enable" = '1' ]; then
lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("configmode", "wizard", nil, { running = "1" }); uci_state:save("configmode")'
uci set 'configmode.@wizard[0].enabled=0'
uci commit configmode
lua -luci -e 'require "luci.model.uci"; uci_state=luci.model.uci.cursor_state(); uci_state:section("config-mode", "wizard", nil, { running = "1" }); uci_state:save("config-mode")'
uci set 'config-mode.@wizard[0].enabled=0'
uci commit config-mode
ip addr add $configmode_addr/$configmode_plen dev $configmode_iface
ip link set up dev $configmode_iface
ip addr add $config_mode_addr/$config_mode_plen dev $config_mode_iface
ip link set up dev $config_mode_iface
/etc/init.d/haveged start
/etc/init.d/telnet start
......@@ -41,8 +41,8 @@ start() {
# correctly finish firstboot
/etc/init.d/done boot
echo "$configmode_addr $configmode_dnsname" > /tmp/hosts.configmode
dnsmasq -h -H /tmp/hosts.configmode -R -F interface:$configmode_iface,$configmode_dhcp_range -l /tmp/dhcp.leases -O option:router
echo "$config_mode_addr $config_mode_dnsname" > /tmp/hosts.config-mode
dnsmasq -h -H /tmp/hosts.config-mode -R -F interface:$config_mode_iface,$config_mode_dhcp_range -l /tmp/dhcp.leases -O option:router
. /etc/diag.sh
get_status_led
......
#!/bin/sh
OLD_CFG=/etc/config/config_mode
NEW_CFG=/etc/config/configmode
NEW_CFG=/etc/config/config-mode
[ -f $OLD_CFG ] && mv $OLD_CFG $NEW_CFG
#!/bin/sh
OLD_CFG=/etc/config/config_mode
NEW_CFG=/etc/config/configmode
[ -f $OLD_CFG ] && mv $OLD_CFG $NEW_CFG
......@@ -10,54 +10,54 @@ You may obtain a copy of the License at
$Id$
]]--
module("luci.controller.configmode.configmode", package.seeall)
module("luci.controller.config-mode.config-mode", package.seeall)
local meshvpn_name = "mesh_vpn"
function index()
local uci_state = luci.model.uci.cursor_state()
if uci_state:get_first("configmode", "wizard", "running", "0") == "1" then
if uci_state:get_first("config-mode", "wizard", "running", "0") == "1" then
local root = node()
if not root.target then
root.target = alias("configmode")
root.target = alias("config-mode")
root.index = true
end
page = node()
page.lock = true
page.target = alias("configmode")
page.target = alias("config-mode")
page.subindex = true
page.index = false
page = node("configmode")
page.title = _("Configmode")
page.target = alias("configmode", "wizard")
page = node("config-mode")
page.title = _("Wizard")
page.target = alias("config-mode", "wizard")
page.order = 5
page.setuser = "root"
page.setgroup = "root"
page.index = true
entry({"configmode", "wizard"}, form("configmode/wizard")).index = true
entry({"configmode", "reboot"}, call("action_reboot"))
entry({"config-mode", "wizard"}, form("config-mode/wizard")).index = true
entry({"config-mode", "reboot"}, call("action_reboot"))
end
end
function action_reboot()
local configmode = require "luci.tools.configmode"
local configmode = require "luci.tools.config-mode"
local pubkey
local uci = luci.model.uci.cursor()
local meshvpn_enabled = uci:get("fastd", meshvpn_name, "enabled", "0")
if meshvpn_enabled == "1" then
pubkey = configmode.get_fastd_pubkey(meshvpn_name)
end
luci.template.render("configmode/reboot", {pubkey=pubkey})
luci.template.render("config-mode/reboot", {pubkey=pubkey})
uci:foreach("configmode", "wizard", function(s)
uci:set("configmode", s[".name"], "configured", "1")
uci:foreach("config-mode", "wizard", function(s)
uci:set("config-mode", s[".name"], "configured", "1")
end)
uci:save("configmode")
uci:commit("configmode")
uci:save("config-mode")
uci:commit("config-mode")
luci.sys.reboot()
end
local configmode = require "luci.tools.configmode"
local configmode = require "luci.tools.config-mode"
local meshvpn_name = "mesh_vpn"
local uci = luci.model.uci.cursor()
local f, s, o
......@@ -75,7 +75,7 @@ function f.handle(self, state, data)
uci:save("system")
uci:commit("system")
luci.http.redirect(luci.dispatcher.build_url("configmode", "reboot"))
luci.http.redirect(luci.dispatcher.build_url("config-mode", "reboot"))
end
return true
......
local luci = require "luci"
local io = require "io"
module "luci.tools.configmode"
module "luci.tools.config-mode"
function setup_fastd_secret(name)
local uci = luci.model.uci.cursor()
......
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