summaryrefslogtreecommitdiff
path: root/src/cryptsetup/cryptsetup-generator.c
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2013-03-29 22:01:12 +0000
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-01 00:37:48 -0400
commitceca950145f35f06938acba62af0c678f896e87d (patch)
tree234eaefe2a0113741ca066a26fbe032e4010dc5c /src/cryptsetup/cryptsetup-generator.c
parent9ece938a676eb80a9d6834c1957b85b884419f8b (diff)
cryptsetup: add RequiresMountsFor for keyfile
This ensures that the keyfile is available during the opening of the encrypted device. Also dropped the explicit ordering Before=local-fs.target, as the containers are ordered implicitly by their content.
Diffstat (limited to 'src/cryptsetup/cryptsetup-generator.c')
-rw-r--r--src/cryptsetup/cryptsetup-generator.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index a8c856f7df..6b9bc554be 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -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,