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.
This commit is contained in:
Thomas Weißschuh 2013-03-29 22:01:12 +00:00 committed by Zbigniew Jędrzejewski-Szmek
parent 9ece938a67
commit ceca950145

View File

@ -118,12 +118,17 @@ static int create_disk(
fprintf(f, fprintf(f,
"Before=cryptsetup.target\n"); "Before=cryptsetup.target\n");
if (password && (streq(password, "/dev/urandom") || if (password) {
streq(password, "/dev/random") || if (streq(password, "/dev/urandom") ||
streq(password, "/dev/hw_random"))) streq(password, "/dev/random") ||
fputs("After=systemd-random-seed-load.service\n", f); streq(password, "/dev/hw_random"))
else fputs("After=systemd-random-seed-load.service\n", f);
fputs("Before=local-fs.target\n", f); else if (!streq(password, "-") &&
!streq(password, "none"))
fprintf(f,
"RequiresMountsFor=%s\n",
password);
}
if (is_device_path(u)) if (is_device_path(u))
fprintf(f, fprintf(f,