reset 419 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. . /lib/functions.sh
  3. OVERLAY="$( grep ' /overlay ' /proc/mounts )"
  4. case "$ACTION" in
  5. pressed)
  6. [ -z "$OVERLAY" ] && return 0
  7. return 5
  8. ;;
  9. timeout)
  10. . /etc/diag.sh
  11. set_state failsafe
  12. ;;
  13. released)
  14. if [ "$SEEN" -lt 1 ]
  15. then
  16. echo "REBOOT" > /dev/console
  17. sync
  18. reboot
  19. elif [ "$SEEN" -gt 5 -a -n "$OVERLAY" ]
  20. then
  21. echo "FACTORY RESET" > /dev/console
  22. jffs2reset -y && reboot &
  23. fi
  24. ;;
  25. esac
  26. return 0