mirror of
https://github.com/troglobit/finit.git
synced 2026-10-12 10:12:32 +00:00
Add support for single (S) user mode from kernel cmdline
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -81,6 +81,9 @@ void conf_parse_cmdline(void)
|
||||
|
||||
if (string_compare(tok, "rescue") || string_compare(tok, "recover"))
|
||||
rescue = 1;
|
||||
|
||||
if (string_compare(tok, "single") || string_compare(tok, "S"))
|
||||
single = 1;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
@@ -628,6 +631,10 @@ done:
|
||||
/* Drop record of all .conf changes */
|
||||
drop_changes();
|
||||
|
||||
/* Override configured runlevel, user said 'S' on /proc/cmdline */
|
||||
if (BOOTSTRAP && single)
|
||||
cfglevel = 1;
|
||||
|
||||
/*
|
||||
* Set host name, from %DEFHOST, *.conf or /etc/hostname. The
|
||||
* latter wins, if neither exists we default to "noname"
|
||||
|
||||
@@ -54,6 +54,7 @@ int runlevel = 0; /* Bootstrap 'S' */
|
||||
int cfglevel = RUNLEVEL; /* Fallback if no configured runlevel */
|
||||
int prevlevel = -1;
|
||||
int rescue = 0; /* rescue mode from kernel cmdline */
|
||||
int single = 0; /* single user mode from kernel cmdline */
|
||||
char *sdown = NULL;
|
||||
char *network = NULL;
|
||||
char *hostname = NULL;
|
||||
|
||||
@@ -97,6 +97,7 @@ extern int runlevel;
|
||||
extern int cfglevel;
|
||||
extern int prevlevel;
|
||||
extern int rescue;
|
||||
extern int single;
|
||||
extern char *rcsd;
|
||||
extern char *sdown;
|
||||
extern char *network;
|
||||
|
||||
Reference in New Issue
Block a user