]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
getty: do not auto-spawn getty's on VC ttys if console=ttyN is used
authorLennart Poettering <lennart@poettering.net>
Mon, 14 Feb 2011 17:56:51 +0000 (18:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 14 Feb 2011 17:56:55 +0000 (18:56 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=676885

TODO
src/target.c
src/util.c
src/util.h

diff --git a/TODO b/TODO
index 5ec7487e472da25da3e6a61cd52a09eda7f490fe..b2b96826784619433a8749ea0b06c3950609879e 100644 (file)
--- a/TODO
+++ b/TODO
@@ -11,6 +11,10 @@ Bugs:
 
 Features:
 
+* look up crypto partition mount points via fstab to show to the user when prompting for a password
+
+* prohibit socket activation of sysv services
+
 * Maybe store in unit files whether a service should be enabled by default on package installation
 
 * perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable"
index a73a98987633dc4bef2c4698702a11c7133a8011..73130078d991f57e5547c000f5a7ffef5dea281d 100644 (file)
@@ -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;
index e78063c5aadc42548c26baca9c26e2a34b81fea0..d0c903993c6ebb7cde787ff9eeb50b69d4ace443 100644 (file)
@@ -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;
index 3f0f48f32d8f6bb40fb4a688e533b385e3825f2a..a534dcfecc2e9ad98ffe73f03b1f79cb8b8965ad 100644 (file)
@@ -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);