anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0512-units-introduce-getty-pre.target-6667.patch

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