anitazha / rpms / systemd

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