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:
Joachim Nilsson committed 2016-09-18 11:50:07 +02:00
1 parent 2c1e9877f9
commit f7d6d269c7
6 files changed
+49 -50

No files matched your search

+8 -7
View File
@@ -160,13 +160,14 @@ restart:
/* Cleanup stale services */
svc_clean_dynamic(service_unregister);
if (0 == runlevel) {
do_shutdown(SHUT_OFF);
sm->state = SM_RUNNING_STATE;
break;
}
if (6 == runlevel) {
do_shutdown(SHUT_REBOOT);
/*
* "I've seen things you people wouldn't believe. Attack ships on fire off
* the shoulder of Orion. I watched C-beams glitter in the dark near the
* Tannhäuser Gate. All those .. moments .. will be lost in time, like
* tears ... in ... rain."
*/
if (runlevel == 0 || runlevel == 6) {
do_shutdown(halt);
sm->state = SM_RUNNING_STATE;
break;
}