On Fri, 01.03.13 15:13, har...@redhat.com (har...@redhat.com) wrote:

> From: Harald Hoyer <har...@redhat.com>
> 
> Write out "JobTimeoutSec=0" for the device the mountpoint (which does
> not timeout) waits for.
> 
> This helps with grabbing a cup of coffee while booting and not have
> the crypto password dialog timeout and systemd in a failed state.

Hmm, this hooks into "wait", which is initialized from the kernel
cmdline rootwait? What are the precise semantics of the kernel there
regarding this flag, in a non-initrd case? We probably should mimic the
kernel here is good as we can...

So, in the non-initrd case: what does rootwait do on the kernel cmdline?
And what happens if it is not used?

> ---
>  src/fstab-generator/fstab-generator.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/src/fstab-generator/fstab-generator.c 
> b/src/fstab-generator/fstab-generator.c
> index d4470f4..026d070 100644
> --- a/src/fstab-generator/fstab-generator.c
> +++ b/src/fstab-generator/fstab-generator.c
> @@ -313,6 +313,32 @@ static int add_mount(const char *what, const char 
> *where, const char *type, cons
>                                  return r;
>  
>                          if (r > 0) {
> +                                if (wait) {
> +                                        free(unit);
> +                                        unit = strjoin(arg_dest, "/",
> device, ".d/JobTimeoutSec0.conf", NULL);


Hmm, we probably should always prefix drop-in snippets we generate with
"50-", so that people can easily order their stuff before/after what we
write here.

> +
> +                                        mkdir_parents_label(unit, 0755);
> +
> +                                        fclose(f);
> +                                        f = fopen(unit, "wxe");
> +                                        if (!f) {
> +                                                log_error("Failed to create 
> unit file %s: %m", unit);
> +                                                return -errno;
> +                                        }
> +
> +                                        fprintf(f,
> +                                                "# Automatically generated 
> by systemd-cryptsetup-generator\n\n"
> +                                                "[Unit]\n"
> +                                                "JobTimeoutSec=0\n"
> +                                                );
> +                                        fflush(f);
> +
> +                                        if (ferror(f)) {
> +                                                log_error("Failed to write 
> file %s: %m", unit);
> +                                                return -errno;
> +                                        }


Hmm, probably something to use write_one_line_file() for. (Which should
probably be renamed, given that it is useful for writing multi-line
files, too...)

> +                                }
> +
>                                  free(lnk);
>                                  lnk = strjoin(arg_dest, "/", device, 
> ".wants/", name, NULL);
>                                  if (!lnk)

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to