When the halt command is called with the -p flag (or as poweroff)
the command now passes the "-h -P" flags to shutdown. This in turn sets the INIT_HALT environment variable to POWEROFF. Assuming this value is checked by initscripts during the shutting down procedure, it should cause the system to be powered off. If halt is called without -p then the value of INIT_HALT is not set and the default action (often set in /etc/defaut/halt) is taken.
This commit is contained in:
parent
c03e2fac2b
commit
f0e93128bc
@ -5,6 +5,15 @@ sysvinit (2.93) released; urgency=low
|
||||
* Fixed error where pidof would not omit checking PIDs passed
|
||||
to it when the -o flag was used.
|
||||
Fixes Debian bug #913394.
|
||||
* When the halt command is called with the -p flag (or as poweroff)
|
||||
the command now passes the "-h -P" flags to shutdown. This
|
||||
in turn sets the INIT_HALT environment variable to POWEROFF.
|
||||
Assuming this value is checked by initscripts during the
|
||||
shutting down procedure, it should cause the system to
|
||||
be powered off.
|
||||
If halt is called without -p then the value of INIT_HALT
|
||||
is not set and the default action (often set in /etc/defaut/halt)
|
||||
is taken.
|
||||
|
||||
|
||||
sysvinit (2.92) released; urgency=low
|
||||
|
@ -155,13 +155,15 @@ int get_runlevel(void)
|
||||
/*
|
||||
* Switch to another runlevel.
|
||||
*/
|
||||
void do_shutdown(char *fl, char *tm)
|
||||
void do_shutdown(char *fl, int should_poweroff, char *tm)
|
||||
{
|
||||
char *args[8];
|
||||
char *args[9];
|
||||
int i = 0;
|
||||
|
||||
args[i++] = "shutdown";
|
||||
args[i++] = fl;
|
||||
if ( (! strcmp(fl, "-h") ) && (should_poweroff) )
|
||||
args[i++] = "-P";
|
||||
if (tm) {
|
||||
args[i++] = "-t";
|
||||
args[i++] = tm;
|
||||
@ -259,7 +261,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
c = get_runlevel();
|
||||
if (c != '0' && c != '6')
|
||||
do_shutdown(do_reboot ? "-r" : "-h", tm);
|
||||
do_shutdown(do_reboot ? "-r" : "-h", do_poweroff, tm);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user