aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init/halt.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/init/halt.c b/init/halt.c
index 29e60657b..b7fb10869 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -7,22 +7,28 @@
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
-//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP))
-//applet:IF_HALT(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
-//applet:IF_HALT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
-
-//kbuild:lib-$(CONFIG_HALT) += halt.o
-
//config:config HALT
-//config: bool "poweroff, halt, and reboot"
+//config: bool "halt"
+//config: default y
+//config: help
+//config: Stop all processes and halt the system.
+//config:
+//config:config POWEROFF
+//config: bool "poweroff"
//config: default y
//config: help
-//config: Stop all processes and either halt, reboot, or power off the system.
+//config: Stop all processes and power off the system.
+//config:
+//config:config REBOOT
+//config: bool "reboot"
+//config: default y
+//config: help
+//config: Stop all processes and reboot the system.
//config:
//config:config FEATURE_CALL_TELINIT
//config: bool "Call telinit on shutdown and reboot"
//config: default y
-//config: depends on HALT && !INIT
+//config: depends on (HALT || POWEROFF || REBOOT) && !INIT
//config: help
//config: Call an external program (normally telinit) to facilitate
//config: a switch to a proper runlevel.
@@ -39,6 +45,14 @@
//config: to facilitate proper shutdown, this path is to be used when
//config: locating telinit executable.
+//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP))
+//applet:IF_POWEROFF(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
+//applet:IF_REBOOT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
+
+//kbuild:lib-$(CONFIG_HALT) += halt.o
+//kbuild:lib-$(CONFIG_POWEROFF) += halt.o
+//kbuild:lib-$(CONFIG_REBOOT) += halt.o
+
//usage:#define halt_trivial_usage
//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]")
//usage:#define halt_full_usage "\n\n"
@@ -109,6 +123,15 @@ int halt_main(int argc UNUSED_PARAM, char **argv)
int which, flags, rc;
/* Figure out which applet we're running */
+ if (ENABLE_HALT && !ENABLE_POWEROFF && !ENABLE_REBOOT)
+ which = 0;
+ else
+ if (!ENABLE_HALT && ENABLE_POWEROFF && !ENABLE_REBOOT)
+ which = 1;
+ else
+ if (!ENABLE_HALT && !ENABLE_POWEROFF && ENABLE_REBOOT)
+ which = 2;
+ else
for (which = 0; "hpr"[which] != applet_name[0]; which++)
continue;