ffhh-packages/gluon-config-mode-ffhh/files/etc/hotplug.d/button/50-gluon-config-mode
2014-06-27 17:41:32 +02:00

30 lines
447 B
Bash
Executable file

#!/bin/sh
wait=3
wait_config_mode() {
sleep $wait
uci set 'gluon-config-mode.@wizard[0].enabled=1'
uci commit gluon-config-mode
reboot
}
if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then
case "$ACTION" in
pressed)
wait_config_mode &
PID=$!
echo $PID > /tmp/.wait_config_mode
;;
released)
if [ -r /tmp/.wait_config_mode ]; then
kill $(cat /tmp/.wait_config_mode)
rm /tmp/.wait_config_mode
fi
;;
esac
fi