mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
Change to runlevel 0/6 on reboot/halt/poweroff
This patch fixes a long-standing issue with how Finit handles shutdown, reboot and poweroff -- and even runlevel changes to runlevel 0 and 6. Prior to this patch sig.c:do_shutdown() was called immediately on any of the above events, disregarding any services that a user might have wanted to run as part of the shutdown/reboot. With this change the handling is unified in all frontends to instead do a runlevel change followed by the do_shutdown() action. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
2c1e9877f9
commit
f7d6d269c7
6 files changed
+49
-50
No files matched your search
@@ -80,6 +80,13 @@
|
||||
#include "service.h"
|
||||
#include "utmp-api.h"
|
||||
|
||||
/*
|
||||
* Old-style SysV shutdown sends a setenv cmd INIT_HALT with "=HALT",
|
||||
* "=POWERDOWN", or "" to cancel shutdown, before requesting change to
|
||||
* runlevel 6 over the /dev/initctl FIFO. See plugins/initctl.c
|
||||
*/
|
||||
shutop_t halt = SHUT_DEFAULT;
|
||||
|
||||
static int stopped = 0;
|
||||
static uev_t sigterm_watcher, sigusr1_watcher, sigusr2_watcher;
|
||||
static uev_t sighup_watcher, sigint_watcher, sigpwr_watcher;
|
||||
@@ -184,7 +191,8 @@ static void sighup_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
*/
|
||||
static void sigint_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
{
|
||||
do_shutdown(SHUT_REBOOT);
|
||||
halt = SHUT_REBOOT;
|
||||
service_runlevel(6);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -192,7 +200,8 @@ static void sigint_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
*/
|
||||
static void sigusr1_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
{
|
||||
do_shutdown(SHUT_HALT);
|
||||
halt = SHUT_HALT;
|
||||
service_runlevel(0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -200,7 +209,8 @@ static void sigusr1_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
*/
|
||||
static void sigusr2_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
{
|
||||
do_shutdown(SHUT_OFF);
|
||||
halt = SHUT_OFF;
|
||||
service_runlevel(0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -208,7 +218,8 @@ static void sigusr2_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
*/
|
||||
static void sigterm_cb(uev_t *UNUSED(w), void *UNUSED(arg), int UNUSED(events))
|
||||
{
|
||||
do_shutdown(SHUT_REBOOT);
|
||||
halt = SHUT_REBOOT;
|
||||
service_runlevel(6);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user