diff options
author | David Tardon <dtardon@redhat.com> | 2023-05-25 09:03:10 +0200 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-05-25 19:30:32 +0200 |
commit | 9a2982b687fe00676b9eac0d8e3ae9bdc88e5711 (patch) | |
tree | 6dfc6133af480dbecba392289eb4c952fe9845e6 /src/gpt-auto-generator | |
parent | man: add trailing = (diff) | |
download | systemd-9a2982b687fe00676b9eac0d8e3ae9bdc88e5711.tar.xz systemd-9a2982b687fe00676b9eac0d8e3ae9bdc88e5711.zip |
gpt-auto-generator: also honor systemd.swap=no
Diffstat (limited to 'src/gpt-auto-generator')
-rw-r--r-- | src/gpt-auto-generator/gpt-auto-generator.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index 030ada5d6e..e3b3b1b228 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -41,6 +41,7 @@ static const char *arg_dest = NULL; static bool arg_enabled = true; static bool arg_root_enabled = true; +static bool arg_swap_enabled = true; static char *arg_root_fstype = NULL; static char *arg_root_options = NULL; static int arg_root_rw = -1; @@ -350,6 +351,9 @@ static int add_partition_swap(DissectedPartition *p) { assert(p); assert(p->node); + if (!arg_swap_enabled) + return 0; + /* Disable the swap auto logic if at least one swap is defined in /etc/fstab, see #6192. */ r = fstab_has_fstype("swap"); if (r < 0) @@ -891,6 +895,19 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat else if (proc_cmdline_key_streq(key, "systemd.image_policy")) return parse_image_policy_argument(optarg, &arg_image_policy); + else if (proc_cmdline_key_streq(key, "systemd.swap")) { + + r = value ? parse_boolean(value) : 1; + if (r < 0) + log_warning_errno(r, "Failed to parse swap switch \"%s\", ignoring: %m", value); + else + arg_swap_enabled = r; + + if (!arg_swap_enabled) + log_debug("Disabling swap partitions auto-detection, systemd.swap=no is defined."); + + } + return 0; } |