50-gluon-setup-mode 443 B

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