anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0535-units-add-remote-cryptsetup.target-and-remote-crypts.patch

dd65c9
From ea1a15b35b70573ab61ca0b8123205c6885c69e4 Mon Sep 17 00:00:00 2001
dd65c9
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
dd65c9
Date: Tue, 5 Sep 2017 10:15:13 +0200
dd65c9
Subject: [PATCH] units: add remote-cryptsetup.target and
dd65c9
 remote-cryptsetup-pre.target
dd65c9
dd65c9
The pair is similar to remote-fs.target and remote-fs-pre.target. Any
dd65c9
cryptsetup devices which require network shall be ordered after
dd65c9
remote-cryptsetup-pre.target and before remote-cryptsetup.target.
dd65c9
dd65c9
Cherry-picked from: 889128b8b27abb13e1691a72e4ce0562c564e257
dd65c9
Resolves: #1384014
dd65c9
---
dd65c9
 Makefile.am                        |  4 +++-
dd65c9
 man/systemd.special.xml            | 23 +++++++++++++++++++++++
dd65c9
 units/cryptsetup-pre.target        |  2 +-
dd65c9
 units/cryptsetup.target            |  2 +-
dd65c9
 units/remote-cryptsetup-pre.target | 15 +++++++++++++++
dd65c9
 units/remote-cryptsetup.target     | 10 ++++++++++
dd65c9
 6 files changed, 53 insertions(+), 3 deletions(-)
dd65c9
 create mode 100644 units/remote-cryptsetup-pre.target
dd65c9
 create mode 100644 units/remote-cryptsetup.target
dd65c9
dd65c9
diff --git a/Makefile.am b/Makefile.am
dd65c9
index 0e2f8d561..a1ebf5cb0 100644
dd65c9
--- a/Makefile.am
dd65c9
+++ b/Makefile.am
dd65c9
@@ -4861,7 +4861,9 @@ systemgenerator_PROGRAMS += \
dd65c9
 
dd65c9
 dist_systemunit_DATA += \
dd65c9
 	units/cryptsetup.target \
dd65c9
-	units/cryptsetup-pre.target
dd65c9
+	units/cryptsetup-pre.target \
dd65c9
+	units/remote-cryptsetup.target \
dd65c9
+	units/remote-cryptsetup-pre.target
dd65c9
 
dd65c9
 systemd_cryptsetup_SOURCES = \
dd65c9
 	src/cryptsetup/cryptsetup.c
dd65c9
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
dd65c9
index eb464f9f8..5529d3bf7 100644
dd65c9
--- a/man/systemd.special.xml
dd65c9
+++ b/man/systemd.special.xml
dd65c9
@@ -81,6 +81,8 @@
dd65c9
     <filename>poweroff.target</filename>,
dd65c9
     <filename>printer.target</filename>,
dd65c9
     <filename>reboot.target</filename>,
dd65c9
+    <filename>remote-cryptsetup-pre.target</filename>,
dd65c9
+    <filename>remote-cryptsetup.target</filename>,
dd65c9
     <filename>remote-fs.target</filename>,
dd65c9
     <filename>remote-fs-pre.target</filename>,
dd65c9
     <filename>rescue.target</filename>,
dd65c9
@@ -404,6 +406,27 @@
dd65c9
           this target unit, for compatibility with SysV.</para>
dd65c9
         </listitem>
dd65c9
       </varlistentry>
dd65c9
+      <varlistentry>
dd65c9
+        <term><filename>remote-cryptsetup-pre.target</filename></term>
dd65c9
+        <listitem>
dd65c9
+          <para>This target unit is automatically ordered before all cryptsetup devices
dd65c9
+          marked with the <option>_netdev</option>. It can be used to execute additional
dd65c9
+          units before such devices are set up.</para>
dd65c9
+
dd65c9
+          <para>It is ordered after <filename>network.target</filename> and
dd65c9
+          <filename>network-online.target</filename>, and also pulls the latter in as a
dd65c9
+          <varname>Wants=</varname> dependency.</para>
dd65c9
+        </listitem>
dd65c9
+      </varlistentry>
dd65c9
+      <varlistentry>
dd65c9
+        <term><filename>remote-cryptsetup.target</filename></term>
dd65c9
+        <listitem>
dd65c9
+          <para>Similar to <filename>cryptsetup.target</filename>, but for encrypted
dd65c9
+          devices which are accessed over the network. It is used for
dd65c9
+          <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>8</manvolnum></citerefentry>
dd65c9
+          entries marked with <option>_netdev</option>.</para>
dd65c9
+        </listitem>
dd65c9
+      </varlistentry>
dd65c9
       <varlistentry>
dd65c9
         <term><filename>remote-fs.target</filename></term>
dd65c9
         <listitem>
dd65c9
diff --git a/units/cryptsetup-pre.target b/units/cryptsetup-pre.target
dd65c9
index 42e35dd4e..6cb28a61a 100644
dd65c9
--- a/units/cryptsetup-pre.target
dd65c9
+++ b/units/cryptsetup-pre.target
dd65c9
@@ -6,7 +6,7 @@
dd65c9
 #  (at your option) any later version.
dd65c9
 
dd65c9
 [Unit]
dd65c9
-Description=Encrypted Volumes (Pre)
dd65c9
+Description=Local Encrypted Volumes (Pre)
dd65c9
 Documentation=man:systemd.special(7)
dd65c9
 RefuseManualStart=yes
dd65c9
 Before=cryptsetup.target
dd65c9
diff --git a/units/cryptsetup.target b/units/cryptsetup.target
dd65c9
index 25d3e33f6..10b17fd38 100644
dd65c9
--- a/units/cryptsetup.target
dd65c9
+++ b/units/cryptsetup.target
dd65c9
@@ -6,5 +6,5 @@
dd65c9
 #  (at your option) any later version.
dd65c9
 
dd65c9
 [Unit]
dd65c9
-Description=Encrypted Volumes
dd65c9
+Description=Local Encrypted Volumes
dd65c9
 Documentation=man:systemd.special(7)
dd65c9
diff --git a/units/remote-cryptsetup-pre.target b/units/remote-cryptsetup-pre.target
dd65c9
new file mode 100644
dd65c9
index 000000000..a375e6188
dd65c9
--- /dev/null
dd65c9
+++ b/units/remote-cryptsetup-pre.target
dd65c9
@@ -0,0 +1,15 @@
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=Remote Encrypted Volumes (Pre)
dd65c9
+Documentation=man:systemd.special(7)
dd65c9
+RefuseManualStart=yes
dd65c9
+Before=remote-cryptsetup.target
dd65c9
+
dd65c9
+After=network.target network-online.target
dd65c9
+Wants=network-online.target
dd65c9
diff --git a/units/remote-cryptsetup.target b/units/remote-cryptsetup.target
dd65c9
new file mode 100644
dd65c9
index 000000000..60943bd1c
dd65c9
--- /dev/null
dd65c9
+++ b/units/remote-cryptsetup.target
dd65c9
@@ -0,0 +1,10 @@
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=Remote Encrypted Volumes
dd65c9
+Documentation=man:systemd.special(7)