Add support for single (S) user mode from kernel cmdline

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2017-12-30 21:20:06 +01:00
parent 5b3df3654c
commit eaa82377c4
3 changed files with 9 additions and 0 deletions
+7
View File
@@ -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"
+1
View File
@@ -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;
+1
View File
@@ -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;