30 lines
427 B
Bash
Executable File
30 lines
427 B
Bash
Executable File
#!/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
|