50-gluon-config-mode 447 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. wait=3
  3. wait_config_mode() {
  4. sleep $wait
  5. uci set 'gluon-config-mode.@wizard[0].enabled=1'
  6. uci commit gluon-config-mode
  7. reboot
  8. }
  9. if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then
  10. case "$ACTION" in
  11. pressed)
  12. wait_config_mode &
  13. PID=$!
  14. echo $PID > /tmp/.wait_config_mode
  15. ;;
  16. released)
  17. if [ -r /tmp/.wait_config_mode ]; then
  18. kill $(cat /tmp/.wait_config_mode)
  19. rm /tmp/.wait_config_mode
  20. fi
  21. ;;
  22. esac
  23. fi