summaryrefslogtreecommitdiff
path: root/packages/busybox/slingbox-1.2.2/halt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/busybox/slingbox-1.2.2/halt.patch')
-rw-r--r--packages/busybox/slingbox-1.2.2/halt.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/busybox/slingbox-1.2.2/halt.patch b/packages/busybox/slingbox-1.2.2/halt.patch
new file mode 100644
index 0000000000..c52e35a8d5
--- /dev/null
+++ b/packages/busybox/slingbox-1.2.2/halt.patch
@@ -0,0 +1,40 @@
+diff -Naur busybox-1.2.2/init.orig/halt.c busybox-1.2.2/init/halt.c
+--- busybox-1.2.2/init.orig/halt.c 2006-11-10 13:39:29.000000000 -0600
++++ busybox-1.2.2/init/halt.c 2006-11-10 13:39:09.000000000 -0600
+@@ -12,6 +12,8 @@
+ #include <sys/reboot.h>
+ #include <unistd.h>
+
++#include "init_shared.h" /* Linksys mods */
++
+ int halt_main(int argc, char *argv[])
+ {
+ static const int magic[] = {
+@@ -40,6 +42,12 @@
+ if (flags&1) sleep(atoi(delay));
+ if (!(flags&2)) sync();
+
++/* Linksys Halt code - adapted from the Linksys source for Busybox. */
++ rc = bb_shutdown_system(magic[which]);
++ if (rc) bb_error_msg("No.");
++ return rc; /* Shrug */
++/* End of Linksys code */
++
+ /* Perform action. */
+ if (ENABLE_INIT && !(flags & 4)) {
+ if (ENABLE_FEATURE_INITRD) {
+diff -Naur busybox-1.2.2/init.orig/init_shared.c busybox-1.2.2/init/init_shared.c
+--- busybox-1.2.2/init.orig/init_shared.c 2006-11-10 13:39:29.000000000 -0600
++++ busybox-1.2.2/init/init_shared.c 2006-11-10 13:38:37.000000000 -0600
+@@ -62,6 +62,11 @@
+
+ sync();
+
++/* Linksys Halt code - if poweroff or halt, invoke an external program
++ to do actually turn off the power. */
++ if (magic != 0x01234567) system("/usr/bin/Set_Led power_off");
++/* End of Linksys Halt code */
++
+ reboot(magic);
+ return 0; /* Shrug */
+ }