gluon/package/gluon-config-mode/files/etc/hotplug.d/button/50-configmode

30 lines
427 B
Plaintext
Raw Normal View History

2013-09-28 21:18:36 +00:00
#!/bin/sh
wait=3
wait_configmode() {
sleep $wait
uci set 'configmode.@wizard[0].enabled=1'
uci commit configmode
reboot
}
if [ "$BUTTON" = wps -o "$BUTTON" = reset ]; then
case "$ACTION" in
pressed)
wait_configmode &
PID=$!
echo $PID > /tmp/.wait_configmode
;;
released)
if [ -r /tmp/.wait_configmode ]; then
kill $(cat /tmp/.wait_configmode)
rm /tmp/.wait_configmode
fi
;;
esac
fi