1
0
mirror of https://github.com/freifunk-gluon/packages.git synced 2024-06-15 19:54:07 +02:00
gluon-packages/gluon/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S15gluon-setup-mode
Matthias Schiffer e7dfba0d03 gluon-setup-mode: cleanup and upgrade fix
Since switching to Barrier Breaker/procd, we'd not notice if we were
upgrading from a version before renaming the config file to gluon-setup-mode
as the upgrade scripts run after the preinit.

Fix this by checking later during setup mode init again and rebooting into the
regular run mode if we detect this case.
2014-08-16 15:15:24 +02:00

21 lines
686 B
Bash
Executable File

#!/bin/sh /etc/rc.common
START=15
boot() {
local enabled="$(uci -q get 'gluon-setup-mode.@setup_mode[0].enabled')"
local configured="$(uci -q get 'gluon-setup-mode.@setup_mode[0].configured')"
uci set 'gluon-setup-mode.@setup_mode[0].enabled=0'
uci commit gluon-setup-mode
if [ "$enabled" = 1 -o "$configured" != 1 ]; then
lua -e 'uci_state=require("luci.model.uci").cursor_state(); uci_state:section("gluon-setup-mode", "setup_mode", nil, { running = "1" }); uci_state:save("gluon-setup-mode")'
else
# This can happen after an upgrade from a version before the config file was called gluon-setup-mode
# We'll just reboot to return to the normal mode...
reboot
fi
}