With this I can shutdown a x86 machine by pressing the powerbutton.
Tested on a KVM Virtual Machine.

Signed-off-by: Stefan Hellermann <[email protected]>

diff --git a/package/busybox/Makefile b/package/busybox/Makefile
index 7aaaf6c..fb497af 100644
--- a/package/busybox/Makefile
+++ b/package/busybox/Makefile
@@ -36,6 +36,7 @@ else
 endif

 init-y :=
+init-$(CONFIG_BUSYBOX_CONFIG_ACPID) += acpid
 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet

@@ -111,6 +112,11 @@ define Package/busybox/install
        for tmp in $(init-y); do \
                $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
        done
+ifeq ($(CONFIG_BUSYBOX_CONFIG_ACPID),y)
+       $(INSTALL_DIR) $(1)/etc/acpi/PWRF
+       $(CP) ./files/acpid.PWRF $(1)/etc/acpi/PWRF/00000080
+endif
+
        -rm -rf $(1)/lib64
 endef

diff --git a/package/busybox/files/acpid b/package/busybox/files/acpid
new file mode 100755
index 0000000..b4404f5
--- /dev/null
+++ b/package/busybox/files/acpid
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2013 OpenWrt.org
+
+START=50
+
+PROG=/sbin/acpid
+SERVICE_USE_PID=1
+
+start () {
+       service_start ${PROG}
+}
+
+stop() {
+       service_stop ${PROG}
+}
diff --git a/package/busybox/files/acpid.PWRF
b/package/busybox/files/acpid.PWRF
new file mode 100755
index 0000000..584edb5
--- /dev/null
+++ b/package/busybox/files/acpid.PWRF
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /sbin/poweroff
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to