[systemd-devel] [PATCH 2/2] cryptsetup: add RequiresMountsFor for passfile

Lennart Poettering lennart at poettering.net
Fri Mar 29 08:09:36 PDT 2013


On Wed, 27.03.13 17:52, Thomas Weißschuh (thomas at t-8ch.de) wrote:

> Removed Before=local-fs.target because the respective mountpoint
> already does this.

I don't grok this comment. 

(Not saying the patch was bad, just not following the explanation
here. I mean, I do wonder myself why we are ordering
Before=local-fs.target here anyway, given that we have cryptsetup.target
anyway...)

> ---
>  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 00e7f7d..70703ae 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 (startswith(u, "/dev/"))
>                  fprintf(f,


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list