summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-30 21:31:40 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-30 23:03:58 +0200
commitb2bb3dbed9607c440b1a9ccacc515e28136d39ae (patch)
tree12bfdedab82abacb60ba3fe1e1a9e46989dc4785 /src/main.c
parent1ceec64c089c796028716c3ef9721ed0f0399569 (diff)
console: rework automatic getty on kernel console logic again
It is essential that the gettys are proper dependencies from getty.target so that they aren't killed and immediately restarted on runlevel changes. Hence rework the logic to implicitly add console gettys to getty.target as dependencies. This also adds an automatic hvc console for virtualizers. https://bugzilla.redhat.com/show_bug.cgi?id=501720
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index f1fa569112..53a455b505 100644
--- a/src/main.c
+++ b/src/main.c
@@ -66,6 +66,7 @@ static bool arg_show_status = true;
static bool arg_sysv_console = true;
static bool arg_mount_auto = true;
static bool arg_swap_auto = true;
+static char *arg_console = NULL;
static FILE* serialization = NULL;
@@ -335,6 +336,26 @@ static int parse_proc_cmdline_word(const char *word) {
"systemd.log_color=0|1 Highlight important log messages\n"
"systemd.log_location=0|1 Include code location in log messages\n");
+ } else if (startswith(word, "console=")) {
+ const char *k;
+ size_t l;
+ char *w = NULL;
+
+ k = word + 8;
+ l = strcspn(k, ",");
+
+ /* Ignore the console setting if set to a VT */
+ if (l < 4 ||
+ !startswith(k, "tty") ||
+ k[3+strspn(k+3, "0123456789")] != 0) {
+
+ if (!(w = strndup(k, l)))
+ return -ENOMEM;
+ }
+
+ free(arg_console);
+ arg_console = w;
+
} else if (streq(word, "quiet")) {
arg_show_status = false;
arg_sysv_console = false;
@@ -993,6 +1014,9 @@ int main(int argc, char *argv[]) {
m->mount_auto = arg_mount_auto;
m->swap_auto = arg_swap_auto;
+ if (arg_console)
+ manager_set_console(m, arg_console);
+
if ((r = manager_startup(m, serialization, fds)) < 0)
log_error("Failed to fully start up daemon: %s", strerror(-r));
@@ -1090,9 +1114,12 @@ finish:
manager_free(m);
free(arg_default_unit);
+ free(arg_console);
dbus_shutdown();
+ label_finish();
+
if (reexecute) {
const char *args[15];
unsigned i = 0;
@@ -1157,7 +1184,5 @@ finish:
if (getpid() == 1)
freeze();
- label_finish();
-
return retval;
}