chiark / gitweb /
cryptsetup: add RequiresMountsFor for keyfile
[elogind.git] / src / cryptsetup / cryptsetup-generator.c
index a8c856f7df45ea993fa11d755d927f27e546ffab..6b9bc554be39b70dbe6cbc073ffda1909a914106 100644 (file)
@@ -118,12 +118,17 @@ static int create_disk(
                 fprintf(f,
                         "Before=cryptsetup.target\n");
 
-        if (password && (streq(password, "/dev/urandom") ||
-                         streq(password, "/dev/random") ||
-                         streq(password, "/dev/hw_random")))
-                fputs("After=systemd-random-seed-load.service\n", f);
-        else
-                fputs("Before=local-fs.target\n", f);
+        if (password) {
+                if (streq(password, "/dev/urandom") ||
+                    streq(password, "/dev/random") ||
+                    streq(password, "/dev/hw_random"))
+                        fputs("After=systemd-random-seed-load.service\n", f);
+                else if (!streq(password, "-") &&
+                         !streq(password, "none"))
+                        fprintf(f,
+                                "RequiresMountsFor=%s\n",
+                                password);
+        }
 
         if (is_device_path(u))
                 fprintf(f,