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

17b0f1
From ea1a15b35b70573ab61ca0b8123205c6885c69e4 Mon Sep 17 00:00:00 2001
17b0f1
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
17b0f1
Date: Tue, 5 Sep 2017 10:15:13 +0200
17b0f1
Subject: [PATCH] units: add remote-cryptsetup.target and
17b0f1
 remote-cryptsetup-pre.target
17b0f1
17b0f1
The pair is similar to remote-fs.target and remote-fs-pre.target. Any
17b0f1
cryptsetup devices which require network shall be ordered after
17b0f1
remote-cryptsetup-pre.target and before remote-cryptsetup.target.
17b0f1
17b0f1
Cherry-picked from: 889128b8b27abb13e1691a72e4ce0562c564e257
17b0f1
Resolves: #1384014
17b0f1
---
17b0f1
 Makefile.am                        |  4 +++-
17b0f1
 man/systemd.special.xml            | 23 +++++++++++++++++++++++
17b0f1
 units/cryptsetup-pre.target        |  2 +-
17b0f1
 units/cryptsetup.target            |  2 +-
17b0f1
 units/remote-cryptsetup-pre.target | 15 +++++++++++++++
17b0f1
 units/remote-cryptsetup.target     | 10 ++++++++++
17b0f1
 6 files changed, 53 insertions(+), 3 deletions(-)
17b0f1
 create mode 100644 units/remote-cryptsetup-pre.target
17b0f1
 create mode 100644 units/remote-cryptsetup.target
17b0f1
17b0f1
diff --git a/Makefile.am b/Makefile.am
17b0f1
index 0e2f8d561c..a1ebf5cb07 100644
17b0f1
--- a/Makefile.am
17b0f1
+++ b/Makefile.am
17b0f1
@@ -4861,7 +4861,9 @@ systemgenerator_PROGRAMS += \
17b0f1
 
17b0f1
 dist_systemunit_DATA += \
17b0f1
 	units/cryptsetup.target \
17b0f1
-	units/cryptsetup-pre.target
17b0f1
+	units/cryptsetup-pre.target \
17b0f1
+	units/remote-cryptsetup.target \
17b0f1
+	units/remote-cryptsetup-pre.target
17b0f1
 
17b0f1
 systemd_cryptsetup_SOURCES = \
17b0f1
 	src/cryptsetup/cryptsetup.c
17b0f1
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
17b0f1
index eb464f9f81..5529d3bf7e 100644
17b0f1
--- a/man/systemd.special.xml
17b0f1
+++ b/man/systemd.special.xml
17b0f1
@@ -81,6 +81,8 @@
17b0f1
     <filename>poweroff.target</filename>,
17b0f1
     <filename>printer.target</filename>,
17b0f1
     <filename>reboot.target</filename>,
17b0f1
+    <filename>remote-cryptsetup-pre.target</filename>,
17b0f1
+    <filename>remote-cryptsetup.target</filename>,
17b0f1
     <filename>remote-fs.target</filename>,
17b0f1
     <filename>remote-fs-pre.target</filename>,
17b0f1
     <filename>rescue.target</filename>,
17b0f1
@@ -404,6 +406,27 @@
17b0f1
           this target unit, for compatibility with SysV.</para>
17b0f1
         </listitem>
17b0f1
       </varlistentry>
17b0f1
+      <varlistentry>
17b0f1
+        <term><filename>remote-cryptsetup-pre.target</filename></term>
17b0f1
+        <listitem>
17b0f1
+          <para>This target unit is automatically ordered before all cryptsetup devices
17b0f1
+          marked with the <option>_netdev</option>. It can be used to execute additional
17b0f1
+          units before such devices are set up.</para>
17b0f1
+
17b0f1
+          <para>It is ordered after <filename>network.target</filename> and
17b0f1
+          <filename>network-online.target</filename>, and also pulls the latter in as a
17b0f1
+          <varname>Wants=</varname> dependency.</para>
17b0f1
+        </listitem>
17b0f1
+      </varlistentry>
17b0f1
+      <varlistentry>
17b0f1
+        <term><filename>remote-cryptsetup.target</filename></term>
17b0f1
+        <listitem>
17b0f1
+          <para>Similar to <filename>cryptsetup.target</filename>, but for encrypted
17b0f1
+          devices which are accessed over the network. It is used for
17b0f1
+          <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>8</manvolnum></citerefentry>
17b0f1
+          entries marked with <option>_netdev</option>.</para>
17b0f1
+        </listitem>
17b0f1
+      </varlistentry>
17b0f1
       <varlistentry>
17b0f1
         <term><filename>remote-fs.target</filename></term>
17b0f1
         <listitem>
17b0f1
diff --git a/units/cryptsetup-pre.target b/units/cryptsetup-pre.target
17b0f1
index 42e35dd4e4..6cb28a61ae 100644
17b0f1
--- a/units/cryptsetup-pre.target
17b0f1
+++ b/units/cryptsetup-pre.target
17b0f1
@@ -6,7 +6,7 @@
17b0f1
 #  (at your option) any later version.
17b0f1
 
17b0f1
 [Unit]
17b0f1
-Description=Encrypted Volumes (Pre)
17b0f1
+Description=Local Encrypted Volumes (Pre)
17b0f1
 Documentation=man:systemd.special(7)
17b0f1
 RefuseManualStart=yes
17b0f1
 Before=cryptsetup.target
17b0f1
diff --git a/units/cryptsetup.target b/units/cryptsetup.target
17b0f1
index 25d3e33f6a..10b17fd387 100644
17b0f1
--- a/units/cryptsetup.target
17b0f1
+++ b/units/cryptsetup.target
17b0f1
@@ -6,5 +6,5 @@
17b0f1
 #  (at your option) any later version.
17b0f1
 
17b0f1
 [Unit]
17b0f1
-Description=Encrypted Volumes
17b0f1
+Description=Local Encrypted Volumes
17b0f1
 Documentation=man:systemd.special(7)
17b0f1
diff --git a/units/remote-cryptsetup-pre.target b/units/remote-cryptsetup-pre.target
17b0f1
new file mode 100644
17b0f1
index 0000000000..a375e61889
17b0f1
--- /dev/null
17b0f1
+++ b/units/remote-cryptsetup-pre.target
17b0f1
@@ -0,0 +1,15 @@
17b0f1
+#  This file is part of systemd.
17b0f1
+#
17b0f1
+#  systemd is free software; you can redistribute it and/or modify it
17b0f1
+#  under the terms of the GNU Lesser General Public License as published by
17b0f1
+#  the Free Software Foundation; either version 2.1 of the License, or
17b0f1
+#  (at your option) any later version.
17b0f1
+
17b0f1
+[Unit]
17b0f1
+Description=Remote Encrypted Volumes (Pre)
17b0f1
+Documentation=man:systemd.special(7)
17b0f1
+RefuseManualStart=yes
17b0f1
+Before=remote-cryptsetup.target
17b0f1
+
17b0f1
+After=network.target network-online.target
17b0f1
+Wants=network-online.target
17b0f1
diff --git a/units/remote-cryptsetup.target b/units/remote-cryptsetup.target
17b0f1
new file mode 100644
17b0f1
index 0000000000..60943bd1cb
17b0f1
--- /dev/null
17b0f1
+++ b/units/remote-cryptsetup.target
17b0f1
@@ -0,0 +1,10 @@
17b0f1
+#  This file is part of systemd.
17b0f1
+#
17b0f1
+#  systemd is free software; you can redistribute it and/or modify it
17b0f1
+#  under the terms of the GNU Lesser General Public License as published by
17b0f1
+#  the Free Software Foundation; either version 2.1 of the License, or
17b0f1
+#  (at your option) any later version.
17b0f1
+
17b0f1
+[Unit]
17b0f1
+Description=Remote Encrypted Volumes
17b0f1
+Documentation=man:systemd.special(7)