base-files: add reboot only button handler
authorAlan Swanson <reiver@improbability.net>
Wed, 29 May 2019 10:28:33 +0000 (11:28 +0100)
committerPetr Štetiar <ynezz@true.cz>
Thu, 30 May 2019 09:55:49 +0000 (11:55 +0200)
For devices such as BTHOMEHUBV5A with both reset and restart buttons,
its easily accessible restart button has been assigned to KEY_POWER
power script to poweroff preventing accidental (or malicious) factory
resets by KEY_RESTART reset script. However an easily accessible button
immediately powering off the device is also undesirable.

Fixes: FS#1965
Signed-off-by: Alan Swanson <reiver@improbability.net>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [long line wrap]
package/base-files/files/etc/rc.button/reboot [new file with mode: 0755]

diff --git a/package/base-files/files/etc/rc.button/reboot b/package/base-files/files/etc/rc.button/reboot
new file mode 100755 (executable)
index 0000000..cd547e3
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+[ "${ACTION}" = "released" ] || exit 0
+
+if [ "$SEEN" -ge 5 ]
+then
+       echo "REBOOT" > /dev/console
+       sync
+       reboot
+fi
+
+return 0