Make halt/poweroff/reboot independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
c314ca9016
commit
97e9a72c71
41
init/halt.c
41
init/halt.c
@ -7,22 +7,28 @@
|
|||||||
* Licensed under GPLv2, see file LICENSE in this source tree.
|
* 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:config HALT
|
||||||
//config: bool "poweroff, halt, and reboot"
|
//config: bool "halt"
|
||||||
//config: default y
|
//config: default y
|
||||||
//config: help
|
//config: help
|
||||||
//config: Stop all processes and either halt, reboot, or power off the system.
|
//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 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:config FEATURE_CALL_TELINIT
|
//config:config FEATURE_CALL_TELINIT
|
||||||
//config: bool "Call telinit on shutdown and reboot"
|
//config: bool "Call telinit on shutdown and reboot"
|
||||||
//config: default y
|
//config: default y
|
||||||
//config: depends on HALT && !INIT
|
//config: depends on (HALT || POWEROFF || REBOOT) && !INIT
|
||||||
//config: help
|
//config: help
|
||||||
//config: Call an external program (normally telinit) to facilitate
|
//config: Call an external program (normally telinit) to facilitate
|
||||||
//config: a switch to a proper runlevel.
|
//config: a switch to a proper runlevel.
|
||||||
@ -39,6 +45,14 @@
|
|||||||
//config: to facilitate proper shutdown, this path is to be used when
|
//config: to facilitate proper shutdown, this path is to be used when
|
||||||
//config: locating telinit executable.
|
//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:#define halt_trivial_usage
|
||||||
//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]")
|
//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]")
|
||||||
//usage:#define halt_full_usage "\n\n"
|
//usage:#define halt_full_usage "\n\n"
|
||||||
@ -109,6 +123,15 @@ int halt_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
int which, flags, rc;
|
int which, flags, rc;
|
||||||
|
|
||||||
/* Figure out which applet we're running */
|
/* 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++)
|
for (which = 0; "hpr"[which] != applet_name[0]; which++)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user