S15gluon-setup-mode 710 B

123456789101112131415161718192021
  1. #!/bin/sh /etc/rc.common
  2. START=15
  3. boot() {
  4. local enabled="$(uci -q get 'gluon-setup-mode.@setup_mode[0].enabled')"
  5. local configured="$(uci -q get 'gluon-setup-mode.@setup_mode[0].configured')"
  6. uci set 'gluon-setup-mode.@setup_mode[0].enabled=0'
  7. uci commit gluon-setup-mode
  8. if [ "$enabled" = 1 -o "$configured" != 1 ]; then
  9. 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")'
  10. else
  11. # This can happen after an upgrade from a version before the config file was called gluon-setup-mode
  12. # We'll just reboot to return to the normal mode...
  13. /etc/init.d/done boot
  14. reboot
  15. fi
  16. }