diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-12-21 09:47:46 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-12-21 22:15:02 +0100 |
commit | cf451f382a6ebf6ad34b36939ed4f8dee1c04e61 (patch) | |
tree | df7342798ef1450b96cde6e8771fe58c45f79fc9 /src/gpt-auto-generator/gpt-auto-generator.c | |
parent | ec6267e8620845bad7b402a0689b425f8ca44fe5 (diff) | |
download | systemd-cf451f382a6ebf6ad34b36939ed4f8dee1c04e61.tar.gz |
gpt-auto-generator: honour rootfstype= and rootflags= kernel cmdline option
Even if root= is not specified on the kernel cmdline, we should honour
the other rootXYZ= options.
Fixes: #8411
See: #17034
Diffstat (limited to 'src/gpt-auto-generator/gpt-auto-generator.c')
-rw-r--r-- | src/gpt-auto-generator/gpt-auto-generator.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index f2f6cc1a53..d697a9b362 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -40,8 +40,13 @@ static const char *arg_dest = NULL; static bool arg_enabled = true; static bool arg_root_enabled = true; +static char *arg_root_fstype = NULL; +static char *arg_root_options = NULL; static int arg_root_rw = -1; +STATIC_DESTRUCTOR_REGISTER(arg_root_fstype, freep); +STATIC_DESTRUCTOR_REGISTER(arg_root_options, freep); + static int add_cryptsetup( const char *id, const char *what, @@ -622,10 +627,10 @@ static int add_root_mount(void) { "root", "/dev/gpt-auto-root", in_initrd() ? "/sysroot" : "/", - NULL, + arg_root_fstype, /* rw= */ arg_root_rw > 0, /* growfs= */ false, - NULL, + arg_root_options, "Root Partition", in_initrd() ? SPECIAL_INITRD_ROOT_FS_TARGET : SPECIAL_LOCAL_FS_TARGET); #else @@ -801,6 +806,21 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat arg_root_enabled = false; + } else if (streq(key, "rootfstype")) { + + if (proc_cmdline_value_missing(key, value)) + return 0; + + return free_and_strdup_warn(&arg_root_fstype, value); + + } else if (streq(key, "rootflags")) { + + if (proc_cmdline_value_missing(key, value)) + return 0; + + if (!strextend_with_separator(&arg_root_options, ",", value)) + return log_oom(); + } else if (proc_cmdline_key_streq(key, "rw") && !value) arg_root_rw = true; else if (proc_cmdline_key_streq(key, "ro") && !value) |