naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
ecbff1
From d538b6082216f4867b4a50c8009abe2462aafbf4 Mon Sep 17 00:00:00 2001
ecbff1
From: Michal Sekletar <msekletar@users.noreply.github.com>
ecbff1
Date: Thu, 31 Aug 2017 11:20:14 +0200
ecbff1
Subject: [PATCH] units: introduce getty-pre.target (#6667)
ecbff1
ecbff1
This new target is a passive unit, hence it is supposed to be pulled in
ecbff1
to the transaction by the service that wants to block login on the
ecbff1
console (e.g. text version of initial-setup). Now both getty and
ecbff1
serial-getty are ordered after this target.
ecbff1
ecbff1
https://lists.freedesktop.org/archives/systemd-devel/2015-July/033754.html
ecbff1
ecbff1
(cherry picked from commit 175902541852fb9207f6e532d8da48c9a102340c)
ecbff1
ecbff1
Conflicts:
ecbff1
	units/meson.build
ecbff1
ecbff1
Resolves: #1173080
ecbff1
---
ecbff1
 Makefile.am                    |  1 +
ecbff1
 man/systemd.special.xml        | 12 ++++++++++++
ecbff1
 units/getty-pre.target         | 11 +++++++++++
ecbff1
 units/getty@.service.m4        |  2 +-
ecbff1
 units/serial-getty@.service.m4 |  2 +-
ecbff1
 5 files changed, 26 insertions(+), 2 deletions(-)
ecbff1
 create mode 100644 units/getty-pre.target
ecbff1
ecbff1
diff --git a/Makefile.am b/Makefile.am
ecbff1
index e9ceac98a..7c58fd050 100644
ecbff1
--- a/Makefile.am
ecbff1
+++ b/Makefile.am
ecbff1
@@ -462,6 +462,7 @@ dist_systemunit_DATA = \
ecbff1
 	units/sysinit.target \
ecbff1
 	units/basic.target \
ecbff1
 	units/getty.target \
ecbff1
+	units/getty-pre.target \
ecbff1
 	units/halt.target \
ecbff1
 	units/kexec.target \
ecbff1
 	units/local-fs.target \
ecbff1
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
ecbff1
index 553197d66..eb464f9f8 100644
ecbff1
--- a/man/systemd.special.xml
ecbff1
+++ b/man/systemd.special.xml
ecbff1
@@ -61,6 +61,7 @@
ecbff1
     <filename>exit.target</filename>,
ecbff1
     <filename>final.target</filename>,
ecbff1
     <filename>getty.target</filename>,
ecbff1
+    <filename>getty-pre.target</filename>,
ecbff1
     <filename>graphical.target</filename>,
ecbff1
     <filename>halt.target</filename>,
ecbff1
     <filename>hibernate.target</filename>,
ecbff1
@@ -216,6 +217,17 @@
ecbff1
           </para>
ecbff1
         </listitem>
ecbff1
       </varlistentry>
ecbff1
+      <varlistentry>
ecbff1
+        <term><filename>getty-pre.target</filename></term>
ecbff1
+        <listitem>
ecbff1
+          <para>A special passive target unit. Users of this target
ecbff1
+          are expected to pull it in the boot transaction via
ecbff1
+          a dependency (e.g. <varname>Wants=</varname>). Order your
ecbff1
+          unit before this unit if you want to make use of the console
ecbff1
+          just before <filename>getty</filename> is started.
ecbff1
+          </para>
ecbff1
+        </listitem>
ecbff1
+      </varlistentry>
ecbff1
       <varlistentry>
ecbff1
         <term><filename>graphical.target</filename></term>
ecbff1
         <listitem>
ecbff1
diff --git a/units/getty-pre.target b/units/getty-pre.target
ecbff1
new file mode 100644
ecbff1
index 000000000..f6c78b6c2
ecbff1
--- /dev/null
ecbff1
+++ b/units/getty-pre.target
ecbff1
@@ -0,0 +1,11 @@
ecbff1
+#  This file is part of systemd.
ecbff1
+#
ecbff1
+#  systemd is free software; you can redistribute it and/or modify it
ecbff1
+#  under the terms of the GNU Lesser General Public License as published by
ecbff1
+#  the Free Software Foundation; either version 2.1 of the License, or
ecbff1
+#  (at your option) any later version.
ecbff1
+
ecbff1
+[Unit]
ecbff1
+Description=Login Prompts (Pre)
ecbff1
+Documentation=man:systemd.special(7) man:systemd-getty-generator(8)
ecbff1
+Documentation=http://0pointer.de/blog/projects/serial-console.html
ecbff1
diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
ecbff1
index 46164ab9d..ad4bf2103 100644
ecbff1
--- a/units/getty@.service.m4
ecbff1
+++ b/units/getty@.service.m4
ecbff1
@@ -9,7 +9,7 @@
ecbff1
 Description=Getty on %I
ecbff1
 Documentation=man:agetty(8) man:systemd-getty-generator(8)
ecbff1
 Documentation=http://0pointer.de/blog/projects/serial-console.html
ecbff1
-After=systemd-user-sessions.service plymouth-quit-wait.service
ecbff1
+After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
ecbff1
 m4_ifdef(`HAVE_SYSV_COMPAT',
ecbff1
 After=rc-local.service
ecbff1
 )m4_dnl
ecbff1
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
ecbff1
index 4522d0d2b..6802333f7 100644
ecbff1
--- a/units/serial-getty@.service.m4
ecbff1
+++ b/units/serial-getty@.service.m4
ecbff1
@@ -10,7 +10,7 @@ Description=Serial Getty on %I
ecbff1
 Documentation=man:agetty(8) man:systemd-getty-generator(8)
ecbff1
 Documentation=http://0pointer.de/blog/projects/serial-console.html
ecbff1
 BindsTo=dev-%i.device
ecbff1
-After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
ecbff1
+After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
ecbff1
 m4_ifdef(`HAVE_SYSV_COMPAT',
ecbff1
 After=rc-local.service
ecbff1
 )m4_dnl