diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/target.c | 7 | ||||
-rw-r--r-- | src/util.c | 14 | ||||
-rw-r--r-- | src/util.h | 1 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/target.c b/src/target.c index a73a989876..73130078d9 100644 --- a/src/target.c +++ b/src/target.c @@ -91,7 +91,12 @@ static int target_add_getty_dependencies(Target *t) { /* Automatically add in a serial getty on the kernel * console */ - if (t->meta.manager->console) { + if (t->meta.manager->console && !tty_is_vc(t->meta.manager->console)) { + + /* We assume that gettys on virtual terminals are + * started via manual configuration and do this magic + * only for non-VC terminals. */ + log_debug("Automatically adding serial getty for %s", t->meta.manager->console); if (!(n = unit_name_replace_instance(SPECIAL_SERIAL_GETTY_SERVICE, t->meta.manager->console))) return -ENOMEM; diff --git a/src/util.c b/src/util.c index e78063c5aa..d0c903993c 100644 --- a/src/util.c +++ b/src/util.c @@ -3549,6 +3549,16 @@ void filter_environ(const char *prefix) { environ[j] = NULL; } +bool tty_is_vc(const char *tty) { + assert(tty); + + if (startswith(tty, "/dev/")) + tty += 5; + + return startswith(tty, "tty") && + tty[3] >= '0' && tty[3] <= '9'; +} + const char *default_term_for_tty(const char *tty) { char *active = NULL; const char *term; @@ -3566,9 +3576,7 @@ const char *default_term_for_tty(const char *tty) { tty = active; } - term = (startswith(tty, "tty") && - tty[3] >= '0' && tty[3] <= '9') ? "TERM=linux" : "TERM=vt100"; - + term = tty_is_vc(tty) ? "TERM=linux" : "TERM=vt100"; free(active); return term; diff --git a/src/util.h b/src/util.h index 3f0f48f32d..a534dcfecc 100644 --- a/src/util.h +++ b/src/util.h @@ -370,6 +370,7 @@ char *fstab_node_to_udev_node(const char *p); void filter_environ(const char *prefix); +bool tty_is_vc(const char *tty); const char *default_term_for_tty(const char *tty); bool running_in_vm(void); |