gluon/package/gluon-setup-mode/files/lib/gluon/setup-mode/rc.d/S15gluon-setup-mode
Matthias Schiffer 8e33dd5075 gluon-setup-mode: always finalize the overlay before rebooting
When an early reboot is triggered because an upgrade script has disabled the
config mode, we need to explicitly call /etc/init.d/done, otherwise the overlay
will not be finalized after a firstboot and we get an endless reboot loop.
2015-01-22 23:53:56 +01:00

22 lines
710 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...
/etc/init.d/done boot
reboot
fi
}