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