From ceca950145f35f06938acba62af0c678f896e87d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Fri, 29 Mar 2013 22:01:12 +0000 Subject: [PATCH] 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. --- src/cryptsetup/cryptsetup-generator.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index a8c856f7d..6b9bc554b 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, -- 2.30.2