diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-14 04:55:04 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-11-14 04:55:04 +0100 |
commit | 97e9a72c71d0238c9f241612ce4af923c16954c7 (patch) | |
tree | cde7b1a2f778c90d7d296b1e293a421cf4955992 /init | |
parent | c314ca9016530aae61b4e50242ba6a6e09b2914a (diff) | |
download | busybox-w32-97e9a72c71d0238c9f241612ce4af923c16954c7.tar.gz busybox-w32-97e9a72c71d0238c9f241612ce4af923c16954c7.tar.bz2 busybox-w32-97e9a72c71d0238c9f241612ce4af923c16954c7.zip |
Make halt/poweroff/reboot independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init')
-rw-r--r-- | init/halt.c | 41 |
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 @@ | |||
7 | * Licensed under GPLv2, see file LICENSE in this source tree. | 7 | * Licensed under GPLv2, see file LICENSE in this source tree. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | //applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP)) | ||
11 | //applet:IF_HALT(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff)) | ||
12 | //applet:IF_HALT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot)) | ||
13 | |||
14 | //kbuild:lib-$(CONFIG_HALT) += halt.o | ||
15 | |||
16 | //config:config HALT | 10 | //config:config HALT |
17 | //config: bool "poweroff, halt, and reboot" | 11 | //config: bool "halt" |
12 | //config: default y | ||
13 | //config: help | ||
14 | //config: Stop all processes and halt the system. | ||
15 | //config: | ||
16 | //config:config POWEROFF | ||
17 | //config: bool "poweroff" | ||
18 | //config: default y | 18 | //config: default y |
19 | //config: help | 19 | //config: help |
20 | //config: Stop all processes and either halt, reboot, or power off the system. | 20 | //config: Stop all processes and power off the system. |
21 | //config: | ||
22 | //config:config REBOOT | ||
23 | //config: bool "reboot" | ||
24 | //config: default y | ||
25 | //config: help | ||
26 | //config: Stop all processes and reboot the system. | ||
21 | //config: | 27 | //config: |
22 | //config:config FEATURE_CALL_TELINIT | 28 | //config:config FEATURE_CALL_TELINIT |
23 | //config: bool "Call telinit on shutdown and reboot" | 29 | //config: bool "Call telinit on shutdown and reboot" |
24 | //config: default y | 30 | //config: default y |
25 | //config: depends on HALT && !INIT | 31 | //config: depends on (HALT || POWEROFF || REBOOT) && !INIT |
26 | //config: help | 32 | //config: help |
27 | //config: Call an external program (normally telinit) to facilitate | 33 | //config: Call an external program (normally telinit) to facilitate |
28 | //config: a switch to a proper runlevel. | 34 | //config: a switch to a proper runlevel. |
@@ -39,6 +45,14 @@ | |||
39 | //config: to facilitate proper shutdown, this path is to be used when | 45 | //config: to facilitate proper shutdown, this path is to be used when |
40 | //config: locating telinit executable. | 46 | //config: locating telinit executable. |
41 | 47 | ||
48 | //applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP)) | ||
49 | //applet:IF_POWEROFF(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff)) | ||
50 | //applet:IF_REBOOT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot)) | ||
51 | |||
52 | //kbuild:lib-$(CONFIG_HALT) += halt.o | ||
53 | //kbuild:lib-$(CONFIG_POWEROFF) += halt.o | ||
54 | //kbuild:lib-$(CONFIG_REBOOT) += halt.o | ||
55 | |||
42 | //usage:#define halt_trivial_usage | 56 | //usage:#define halt_trivial_usage |
43 | //usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]") | 57 | //usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]") |
44 | //usage:#define halt_full_usage "\n\n" | 58 | //usage:#define halt_full_usage "\n\n" |
@@ -109,6 +123,15 @@ int halt_main(int argc UNUSED_PARAM, char **argv) | |||
109 | int which, flags, rc; | 123 | int which, flags, rc; |
110 | 124 | ||
111 | /* Figure out which applet we're running */ | 125 | /* Figure out which applet we're running */ |
126 | if (ENABLE_HALT && !ENABLE_POWEROFF && !ENABLE_REBOOT) | ||
127 | which = 0; | ||
128 | else | ||
129 | if (!ENABLE_HALT && ENABLE_POWEROFF && !ENABLE_REBOOT) | ||
130 | which = 1; | ||
131 | else | ||
132 | if (!ENABLE_HALT && !ENABLE_POWEROFF && ENABLE_REBOOT) | ||
133 | which = 2; | ||
134 | else | ||
112 | for (which = 0; "hpr"[which] != applet_name[0]; which++) | 135 | for (which = 0; "hpr"[which] != applet_name[0]; which++) |
113 | continue; | 136 | continue; |
114 | 137 | ||