chiark / gitweb /
cryptsetup: introduce new cryptsetup-pre.traget unit so that services can make sure...
authorLennart Poettering <lennart@poettering.net>
Tue, 17 Jun 2014 22:07:56 +0000 (00:07 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 17 Jun 2014 22:09:46 +0000 (00:09 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1097938

Makefile.am
man/systemd.special.xml
src/cryptsetup/cryptsetup-generator.c
units/cryptsetup-pre.target [new file with mode: 0644]

index e428141da245b175e3abe75d215a0ccb45a5e8e6..dea0633a95246c9c95658860018f5b0608fa18c1 100644 (file)
@@ -3933,7 +3933,8 @@ systemgenerator_PROGRAMS += \
        systemd-cryptsetup-generator
 
 dist_systemunit_DATA += \
-       units/cryptsetup.target
+       units/cryptsetup.target \
+       units/cryptsetup-pre.target
 
 systemd_cryptsetup_SOURCES = \
        src/cryptsetup/cryptsetup.c
index cda6edd42b54a4d543403a12bd9c8076d7a726e6..f29cc23c2fab69b8f7173fab5ae714182b24bca5 100644 (file)
@@ -52,6 +52,7 @@
                 <filename>bluetooth.target</filename>,
                 <filename>ctrl-alt-del.target</filename>,
                 <filename>cryptsetup.target</filename>,
+                <filename>cryptsetup-pre.target</filename>,
                 <filename>dbus.service</filename>,
                 <filename>dbus.socket</filename>,
                 <filename>default.target</filename>,
                 transaction.</para>
 
                 <variablelist>
+                        <varlistentry>
+                                <term><filename>cryptsetup-pre.target</filename></term>
+                                <listitem>
+                                        <para>This passive target unit
+                                        may be pulled in by services
+                                        that want to run before any
+                                        encrypted block device is set
+                                        up. All encrypted block
+                                        devices are set up after this
+                                        target has been reached. Since
+                                        the shutdown order is
+                                        implicitly the reverse
+                                        start-up order between units
+                                        this target is particularly
+                                        useful to ensure that a
+                                        service is shut down only
+                                        after all encrypted block
+                                        devices are fully
+                                        stopped.</para>
+                                </listitem>
+                        </varlistentry>
                         <varlistentry>
                                 <term><filename>local-fs-pre.target</filename></term>
                                 <listitem>
index f4eeb2ad93072ea1a8da96cd514dddfeb74faba8..dfdca1e47b4e3ce82ddf7fd6027a5f89e748b5d8 100644 (file)
@@ -127,7 +127,7 @@ static int create_disk(
                 "Conflicts=umount.target\n"
                 "BindsTo=dev-mapper-%i.device\n"
                 "IgnoreOnIsolate=true\n"
-                "After=systemd-readahead-collect.service systemd-readahead-replay.service\n",
+                "After=systemd-readahead-collect.service systemd-readahead-replay.service cryptsetup-pre.target\n",
                 f);
 
         if (!nofail)
diff --git a/units/cryptsetup-pre.target b/units/cryptsetup-pre.target
new file mode 100644 (file)
index 0000000..6535341
--- /dev/null
@@ -0,0 +1,11 @@
+#  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=Encrypted Volumes (Pre)
+Documentation=man:systemd.special(7)
+RefuseManualStart=yes