mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Touch /etc/nologin when runlevel change comes in
The /etc/nologin file must be set as soon as the runlevel change to 0/1/6 comes in, not when done with runlevel change and services have been started, if any. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -127,6 +127,12 @@ restart:
|
||||
_d("Setting new runlevel --> %d <-- previous %d", runlevel, prevlevel);
|
||||
runlevel_set(prevlevel, runlevel);
|
||||
|
||||
/* Disable login in single-user mode as well as shutdown/reboot */
|
||||
if (runlevel == 1 || runlevel == 0 || runlevel == 6)
|
||||
touch("/etc/nologin");
|
||||
else
|
||||
erase("/etc/nologin");
|
||||
|
||||
/* Make sure to (re)load all *.conf in /etc/finit.d/ */
|
||||
conf_reload_dynamic();
|
||||
|
||||
@@ -154,12 +160,6 @@ restart:
|
||||
/* Cleanup stale services */
|
||||
svc_clean_dynamic(service_unregister);
|
||||
|
||||
/* Disable login in single-user mode as well as shutdown/reboot */
|
||||
if (runlevel == 1 || runlevel == 0 || runlevel == 6)
|
||||
touch("/etc/nologin");
|
||||
else
|
||||
erase("/etc/nologin");
|
||||
|
||||
if (0 == runlevel) {
|
||||
do_shutdown(SHUT_OFF);
|
||||
sm->state = SM_RUNNING_STATE;
|
||||
|
||||
Reference in New Issue
Block a user