summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am20
-rw-r--r--src/auto-serial-getty.c (renamed from src/auto-console-getty.c)4
-rw-r--r--units/.gitignore1
-rw-r--r--units/getty@.service.m42
-rw-r--r--units/serial-getty@.service.m437
-rw-r--r--units/systemd-auto-serial-getty.service (renamed from units/systemd-auto-console-getty.service.in)4
7 files changed, 55 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index 1cee1b6328..2c92ae05b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@ systemd-kmsg-syslogd
systemd-remount-api-vfs
test-hostname
systemd-modules-load
-systemd-auto-console-getty
+systemd-auto-serial-getty
systemd-shutdownd
systemd-random-seed
systemd-update-utmp
diff --git a/Makefile.am b/Makefile.am
index aa2998d99d..859d332679 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,7 +73,7 @@ rootlibexec_PROGRAMS = \
systemd-update-utmp \
systemd-random-seed \
systemd-shutdownd \
- systemd-auto-console-getty \
+ systemd-auto-serial-getty \
systemd-modules-load \
systemd-remount-api-vfs \
systemd-kmsg-syslogd
@@ -171,6 +171,7 @@ dist_systemunit_DATA = \
nodist_systemunit_DATA = \
units/sysinit.target \
units/getty@.service \
+ units/serial-getty@.service \
units/graphical.target \
units/remote-fs.target \
units/multi-user.target \
@@ -178,7 +179,7 @@ nodist_systemunit_DATA = \
units/systemd-logger.service \
units/systemd-shutdownd.service \
units/systemd-kmsg-syslogd.service \
- units/systemd-auto-console-getty.service \
+ units/systemd-auto-serial-getty.service \
units/systemd-modules-load.service \
units/systemd-remount-api-vfs.service \
units/systemd-update-utmp-runlevel.service \
@@ -197,6 +198,7 @@ nodist_sessionunit_DATA = \
EXTRA_DIST = \
units/sysinit.target.m4 \
units/getty@.service.m4 \
+ units/serial-getty@.service.m4 \
units/graphical.target.m4 \
units/multi-user.target.m4 \
units/remote-fs.target.m4 \
@@ -204,7 +206,7 @@ EXTRA_DIST = \
units/systemd-logger.service.in \
units/systemd-shutdownd.service.in \
units/systemd-kmsg-syslogd.service.in \
- units/systemd-auto-console-getty.service.in \
+ units/systemd-auto-serial-getty.service.in \
units/systemd-modules-load.service.in \
units/systemd-remount-api-vfs.service.in \
units/systemd-update-utmp-runlevel.service.in \
@@ -573,15 +575,15 @@ systemd_shutdownd_CFLAGS = \
systemd_shutdownd_LDADD = \
libsystemd-basic.la
-systemd_auto_console_getty_SOURCES = \
- src/auto-console-getty.c \
+systemd_auto_serial_getty_SOURCES = \
+ src/auto-serial-getty.c \
src/dbus-common.c
-systemd_auto_console_getty_CFLAGS = \
+systemd_auto_serial_getty_CFLAGS = \
$(AM_CFLAGS) \
$(DBUS_CFLAGS)
-systemd_auto_console_getty_LDADD = \
+systemd_auto_serial_getty_LDADD = \
libsystemd-basic.la \
$(DBUS_LIBS)
@@ -896,14 +898,14 @@ install-data-hook:
$(LN_S) $(systemunitdir)/reboot.target ctrl-alt-del.target && \
$(LN_S) $(systemunitdir)/rescue.target kbrequest.target )
( cd $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants && \
- rm -f getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service systemd-auto-console-getty.service && \
+ rm -f getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service systemd-auto-serial-getty.service && \
$(LN_S) $(systemunitdir)/getty@.service getty@tty1.service && \
$(LN_S) $(systemunitdir)/getty@.service getty@tty2.service && \
$(LN_S) $(systemunitdir)/getty@.service getty@tty3.service && \
$(LN_S) $(systemunitdir)/getty@.service getty@tty4.service && \
$(LN_S) $(systemunitdir)/getty@.service getty@tty5.service && \
$(LN_S) $(systemunitdir)/getty@.service getty@tty6.service && \
- $(LN_S) $(systemunitdir)/systemd-auto-console-getty.service systemd-auto-console-getty.service )
+ $(LN_S) $(systemunitdir)/systemd-auto-serial-getty.service systemd-auto-serial-getty.service )
( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
rm -f getty.target remote-fs.target && \
$(LN_S) $(systemunitdir)/getty.target getty.target && \
diff --git a/src/auto-console-getty.c b/src/auto-serial-getty.c
index 44d2eff732..7bc2fba8da 100644
--- a/src/auto-console-getty.c
+++ b/src/auto-serial-getty.c
@@ -42,7 +42,7 @@ static int spawn_getty(DBusConnection *bus, const char *console) {
assert(console);
/* FIXME: we probably should escape the tty name properly here */
- if (asprintf(&name, "getty@%s.service", console) < 0)
+ if (asprintf(&name, "serial-getty@%s.service", console) < 0)
return -ENOMEM;
if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnit"))) {
@@ -115,7 +115,7 @@ static int parse_proc_cmdline(char **console) {
assert(console);
- if ((r = read_one_line_file("/tmp/cmdline", &line)) < 0) {
+ if ((r = read_one_line_file("/proc/cmdline", &line)) < 0) {
log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
return 0;
}
diff --git a/units/.gitignore b/units/.gitignore
index 82a24170cf..35f790849e 100644
--- a/units/.gitignore
+++ b/units/.gitignore
@@ -1,3 +1,4 @@
+serial-getty@.service
systemd-kmsg-syslogd.service
systemd-modules-load.service
systemd-remount-api-vfs.service
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
index 01343c497f..4b65d5b906 100644
--- a/units/getty@.service.m4
+++ b/units/getty@.service.m4
@@ -30,7 +30,7 @@ Before=getty.target
[Service]
Environment=TERM=linux
-ExecStart=GETTY %I
+ExecStart=-GETTY %I
Restart=restart-always
RestartSec=0
KillMode=process-group
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
new file mode 100644
index 0000000000..b91ed98330
--- /dev/null
+++ b/units/serial-getty@.service.m4
@@ -0,0 +1,37 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Serial Getty on %I
+Requires=dev-%i.device
+After=dev-%i.device
+m4_ifdef(`TARGET_FEDORA',
+After=rc-local.service
+)m4_dnl
+m4_ifdef(`TARGET_ARCH',
+After=rc-local.service
+)m4_dnl
+
+# If additional gettys are spawned during boot (possibly by
+# systemd-auto-console-getty) then we should make sure that this is
+# synchronized before getty.target, even though getty.target didn't
+# actually pull it in.
+Before=getty.target
+
+[Service]
+Environment=TERM=vt100-nav
+m4_ifdef(`TARGET_FEDORA',
+ExecStartPre=-/sbin/securetty %I
+)m4_dnl
+ExecStart=-/sbin/agetty -s %I 115200,38400,9600
+Restart=restart-always
+RestartSec=0
+KillMode=process-group
+
+# Some login implementations ignore SIGTERM, so we send SIGHUP
+# instead, to ensure that login terminates cleanly.
+KillSignal=SIGHUP
diff --git a/units/systemd-auto-console-getty.service.in b/units/systemd-auto-serial-getty.service
index 6542cab18a..8051c7446a 100644
--- a/units/systemd-auto-console-getty.service.in
+++ b/units/systemd-auto-serial-getty.service
@@ -6,11 +6,11 @@
# (at your option) any later version.
[Unit]
-Description=Automatically Spawn getty on Kernel Console
+Description=Automatically Spawn getty on Serial Kernel Console
[Service]
Type=oneshot
-ExecStart=@rootlibexecdir@/systemd-auto-console-getty
+ExecStart=@rootlibexecdir@/systemd-auto-serial-getty
[Install]
WantedBy=getty.target