diff mbox

[OpenWrt-Devel,RFC] base-files: switch reset button support to hotplug.d

Message ID 1431203632-18662-1-git-send-email-zajec5@gmail.com
State RFC
Headers show

Commit Message

Rafał Miłecki May 9, 2015, 8:33 p.m. UTC
For years now we have procd (with its hotplug support) and action JSON
executing all scripts in /etc/hotplug.d/SUBSYSTEM/. Move reset button
support to handle it the same way we handle other subsystems.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 package/base-files/files/etc/hotplug.d/button/reset | 18 ++++++++++++++++++
 package/base-files/files/etc/rc.button/reset        | 18 ------------------
 2 files changed, 18 insertions(+), 18 deletions(-)
 create mode 100755 package/base-files/files/etc/hotplug.d/button/reset
 delete mode 100755 package/base-files/files/etc/rc.button/reset

Comments

Felix Fietkau May 10, 2015, 11:14 a.m. UTC | #1
On 2015-05-09 22:33, Rafał Miłecki wrote:
> For years now we have procd (with its hotplug support) and action JSON
> executing all scripts in /etc/hotplug.d/SUBSYSTEM/. Move reset button
> support to handle it the same way we handle other subsystems.
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
That does not make any sense to me. Especially since we have other
rc.button scripts still in place. I think we should leave the reset
script where it is.

- Felix
Rafał Miłecki May 10, 2015, 11:29 a.m. UTC | #2
On 10 May 2015 at 13:14, Felix Fietkau <nbd@openwrt.org> wrote:
> On 2015-05-09 22:33, Rafał Miłecki wrote:
>> For years now we have procd (with its hotplug support) and action JSON
>> executing all scripts in /etc/hotplug.d/SUBSYSTEM/. Move reset button
>> support to handle it the same way we handle other subsystems.
>>
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> That does not make any sense to me. Especially since we have other
> rc.button scripts still in place. I think we should leave the reset
> script where it is.

My further plan was to move all buttons to the /etc/hotplug.d/. I was
thinking hotplug.d is something more generic and should be preferred.

After that we could leave support for /etc/rc.button/ for one or two
more releases (to let user swtich to hotplug.d). Then finally get rid
of it.
diff mbox

Patch

diff --git a/package/base-files/files/etc/hotplug.d/button/reset b/package/base-files/files/etc/hotplug.d/button/reset
new file mode 100755
index 0000000..4586f0a
--- /dev/null
+++ b/package/base-files/files/etc/hotplug.d/button/reset
@@ -0,0 +1,18 @@ 
+#!/bin/sh
+
+[ "$BUTTON" = "reset" -a "${ACTION}" = "released" ] || exit 0
+
+. /lib/functions.sh
+
+logger "$BUTTON pressed for $SEEN seconds"
+
+if [ "$SEEN" -lt 1 ]
+then
+	echo "REBOOT" > /dev/console
+	sync
+	reboot
+elif [ "$SEEN" -gt 5 ]
+then
+	echo "FACTORY RESET" > /dev/console
+	jffs2reset -y && reboot &
+fi
diff --git a/package/base-files/files/etc/rc.button/reset b/package/base-files/files/etc/rc.button/reset
deleted file mode 100755
index 229b503..0000000
--- a/package/base-files/files/etc/rc.button/reset
+++ /dev/null
@@ -1,18 +0,0 @@ 
-#!/bin/sh
-
-[ "${ACTION}" = "released" ] || exit 0
-
-. /lib/functions.sh
-
-logger "$BUTTON pressed for $SEEN seconds"
-
-if [ "$SEEN" -lt 1 ]
-then
-	echo "REBOOT" > /dev/console
-	sync
-	reboot
-elif [ "$SEEN" -gt 5 ]
-then
-	echo "FACTORY RESET" > /dev/console
-	jffs2reset -y && reboot &
-fi