units: add remote-cryptsetup.target and remote-cryptsetup-pre.target
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 Sep 2017 08:15:13 +0000 (10:15 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 5 Sep 2017 10:06:30 +0000 (12:06 +0200)
The pair is similar to remote-fs.target and remote-fs-pre.target. Any
cryptsetup devices which require network shall be ordered after
remote-cryptsetup-pre.target and before remote-cryptsetup.target.

man/systemd.special.xml
units/cryptsetup-pre.target
units/cryptsetup.target
units/meson.build
units/remote-cryptsetup-pre.target [new file with mode: 0644]
units/remote-cryptsetup.target [new file with mode: 0644]

index 9c916be..2993d67 100644 (file)
@@ -82,6 +82,8 @@
     <filename>poweroff.target</filename>,
     <filename>printer.target</filename>,
     <filename>reboot.target</filename>,
+    <filename>remote-cryptsetup-pre.target</filename>,
+    <filename>remote-cryptsetup.target</filename>,
     <filename>remote-fs-pre.target</filename>,
     <filename>remote-fs.target</filename>,
     <filename>rescue.target</filename>,
         </listitem>
       </varlistentry>
       <varlistentry>
+        <term><filename>remote-cryptsetup-pre.target</filename></term>
+        <listitem>
+          <para>This target unit is automatically ordered before all cryptsetup devices
+          marked with the <option>_netdev</option>. It can be used to execute additional
+          units before such devices are set up.</para>
+
+          <para>It is ordered after <filename>network.target</filename> and
+          <filename>network-online.target</filename>, and also pulls the latter in as a
+          <varname>Wants=</varname> dependency.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><filename>remote-cryptsetup.target</filename></term>
+        <listitem>
+          <para>Similar to <filename>cryptsetup.target</filename>, but for encrypted
+          devices which are accessed over the network. It is used for
+          <citerefentry><refentrytitle>crypttab</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+          entries marked with <option>_netdev</option>.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
         <term><filename>remote-fs.target</filename></term>
         <listitem>
           <para>Similar to <filename>local-fs.target</filename>, but
index 42e35dd..6cb28a6 100644 (file)
@@ -6,7 +6,7 @@
 #  (at your option) any later version.
 
 [Unit]
-Description=Encrypted Volumes (Pre)
+Description=Local Encrypted Volumes (Pre)
 Documentation=man:systemd.special(7)
 RefuseManualStart=yes
 Before=cryptsetup.target
index 25d3e33..10b17fd 100644 (file)
@@ -6,5 +6,5 @@
 #  (at your option) any later version.
 
 [Unit]
-Description=Encrypted Volumes
+Description=Local Encrypted Volumes
 Documentation=man:systemd.special(7)
index be32a39..2024d0b 100644 (file)
@@ -48,6 +48,9 @@ units = [
         ['proc-sys-fs-binfmt_misc.mount',       'ENABLE_BINFMT'],
         ['reboot.target',                       '',
          'runlevel6.target ctrl-alt-del.target'],
+        ['remote-cryptsetup-pre.target',        'HAVE_LIBCRYPTSETUP'],
+        ['remote-cryptsetup.target',            'HAVE_LIBCRYPTSETUP',
+         join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')],
         ['remote-fs-pre.target',                ''],
         ['remote-fs.target',                    '',
          join_paths(pkgsysconfdir, 'system/multi-user.target.wants/')],
diff --git a/units/remote-cryptsetup-pre.target b/units/remote-cryptsetup-pre.target
new file mode 100644 (file)
index 0000000..a375e61
--- /dev/null
@@ -0,0 +1,15 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Remote Encrypted Volumes (Pre)
+Documentation=man:systemd.special(7)
+RefuseManualStart=yes
+Before=remote-cryptsetup.target
+
+After=network.target network-online.target
+Wants=network-online.target
diff --git a/units/remote-cryptsetup.target b/units/remote-cryptsetup.target
new file mode 100644 (file)
index 0000000..60943bd
--- /dev/null
@@ -0,0 +1,10 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Remote Encrypted Volumes
+Documentation=man:systemd.special(7)