diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gpt-auto-generator/gpt-auto-generator.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index 4465038198..585aaae2ed 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -574,10 +574,17 @@ static int add_partition_esp(DissectedPartition *p, bool has_xbootldr) { return 0; } + /* Check if there's an existing fstab entry for ESP. If so, we just skip the gpt-auto logic. */ + r = fstab_has_node(p->node); + if (r < 0) + return log_error_errno(r, + "Failed to check if fstab entry for device '%s' exists: %m", p->node); + if (r > 0) + return 0; + /* If /boot/ is present, unused, and empty, we'll take that. * Otherwise, if /efi/ is unused and empty (or missing), we'll take that. - * Otherwise, we do nothing. - */ + * Otherwise, we do nothing. */ if (!has_xbootldr && slash_boot_exists()) { r = slash_boot_in_fstab(); if (r < 0) @@ -590,16 +597,6 @@ static int add_partition_esp(DissectedPartition *p, bool has_xbootldr) { esp_path = "/boot"; id = "boot"; } - } else { - /* Check if the fstab entry for /boot/ is already the ESP. If so, we don't need to - * check /efi/ or duplicate the mount there. */ - r = fstab_is_mount_point_full("/boot", p->node); - if (r < 0) - return log_error_errno(r, - "Failed to check if fstab entry for /boot uses the same device as '%s': %m", - p->node); - if (r > 0) - return 0; } } |