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 committed 2017-12-30 21:20:06 +01:00
1 parent 5b3df3654c
commit eaa82377c4
3 files changed
+9

No files matched your search

+7
View File
@@ -81,6 +81,9 @@ void conf_parse_cmdline(void)
if (string_compare(tok, "rescue") || string_compare(tok, "recover")) if (string_compare(tok, "rescue") || string_compare(tok, "recover"))
rescue = 1; rescue = 1;
if (string_compare(tok, "single") || string_compare(tok, "S"))
single = 1;
} }
fclose(fp); fclose(fp);
@@ -628,6 +631,10 @@ done:
/* Drop record of all .conf changes */ /* Drop record of all .conf changes */
drop_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 * Set host name, from %DEFHOST, *.conf or /etc/hostname. The
* latter wins, if neither exists we default to "noname" * 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 cfglevel = RUNLEVEL; /* Fallback if no configured runlevel */
int prevlevel = -1; int prevlevel = -1;
int rescue = 0; /* rescue mode from kernel cmdline */ int rescue = 0; /* rescue mode from kernel cmdline */
int single = 0; /* single user mode from kernel cmdline */
char *sdown = NULL; char *sdown = NULL;
char *network = NULL; char *network = NULL;
char *hostname = NULL; char *hostname = NULL;
+1
View File
@@ -97,6 +97,7 @@ extern int runlevel;
extern int cfglevel; extern int cfglevel;
extern int prevlevel; extern int prevlevel;
extern int rescue; extern int rescue;
extern int single;
extern char *rcsd; extern char *rcsd;
extern char *sdown; extern char *sdown;
extern char *network; extern char *network;