[systemd-devel] [PATCH 3/4] fstab-generator: do not overwrite already generated units

Harald Hoyer harald.hoyer at gmail.com
Tue Mar 5 03:35:10 PST 2013


Am 05.03.2013 07:28, schrieb harald at redhat.com:
> From: Harald Hoyer <harald at redhat.com>
> 
> only checks for /run/systemd/generator/*.mount
> ---
>  src/fstab-generator/fstab-generator.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
> index 3b8329b..502f64c 100644
> --- a/src/fstab-generator/fstab-generator.c
> +++ b/src/fstab-generator/fstab-generator.c
> @@ -419,6 +419,21 @@ static int parse_fstab(const char *prefix, bool initrd) {
>                  if (is_path(where))
>                          path_kill_slashes(where);
>  
> +                if (initrd) {
> +                        char _cleanup_free_ *mu = NULL, *name = NULL;
> +                        /* Skip generation, if unit already exists */
> +                        name = unit_name_from_path(where, ".mount");
> +                        if (!name)
> +                                return log_oom();
> +                        mu = strjoin(arg_dest, "/", name, NULL);
> +                        if (!mu)
> +                                return log_oom();
> +
> +                        k = access(mu, R_OK);
> +                        if (k == 0)
> +                                continue;
> +                }
> +
>                  log_debug("Found entry what=%s where=%s type=%s", what, where, me->mnt_type);
>  
>                  if (streq(me->mnt_type, "swap"))
> 

scratch that

most of my problems were solved with:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=135b5212d4234f5b75c9b86c9f924047c8d07589




More information about the systemd-devel mailing list