blob: a6ac5907af92aea6aac26e1a6f5c990eb676f2fc [file] [log] [blame]
#!/bin/sh
log()
{
echo "$0:" "$@" >&2
}
log "starting."
while :; do
log "waiting for reset button."
# gpio-mailbox creates reset_button_msecs when ready.
wait-until-created /tmp/gpio/reset_button_msecs
log "reset button pressed! waiting for button release."
if reset-button-held 2000; then
log "reset button activated."
leds 0 1 0 1 0 0 # blinky red light to indicate initial reset mode
if reset-button-held 10000; then
log "factory reset requested."
leds 0 15 0 15 0 15 # noisy leds to indicate full on factory reset
zap --i-really-mean-it --erase-backups
log "factory reset: rebooting in 10 seconds..."
sleep 10
else
log "reset button: rebooting..."
fi
leds 0
reboot
fi
done