34 lines
597 B
Bash
Executable file
34 lines
597 B
Bash
Executable file
#!/bin/sh
|
|
|
|
. /lib/functions.sh
|
|
|
|
OVERLAY="$( grep ' /overlay ' /proc/mounts )"
|
|
|
|
case "$ACTION" in
|
|
pressed)
|
|
[ -z "$OVERLAY" ] && return 0
|
|
|
|
return 5
|
|
;;
|
|
timeout)
|
|
# . /etc/diag.sh
|
|
# set_state failsafe
|
|
echo "REBOOT" > /dev/console
|
|
sync
|
|
reboot
|
|
;;
|
|
released)
|
|
if [ "$SEEN" -lt 1 ]
|
|
then
|
|
echo "PING" > /dev/console
|
|
ping -c4 10.8.0.1
|
|
elif [ "$SEEN" -ge 5 -a -n "$OVERLAY" ]
|
|
then
|
|
echo "REBOOT" > /dev/console
|
|
sync
|
|
reboot
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
return 0
|