1 --- systemd-stable-254.1/src/gpt-auto-generator/gpt-auto-generator.c.orig 2023-08-09 22:33:59.978475054 +0200
2 +++ systemd-stable-254.1/src/gpt-auto-generator/gpt-auto-generator.c 2023-08-09 22:41:09.618936068 +0200
7 +static int slash_boot_efi_in_fstab(void) {
8 + static int cache = -1;
13 + cache = fstab_is_mount_point("/boot/efi");
15 + return log_error_errno(cache, "Failed to parse fstab: %m");
19 static int add_partition_xbootldr(DissectedPartition *p) {
20 _cleanup_free_ char *options = NULL;
23 return (cache = false);
26 +static bool slash_boot_efi_exists(void) {
27 + static int cache = -1;
32 + if (access("/boot/efi", F_OK) >= 0)
33 + return (cache = true);
34 + if (errno != ENOENT)
35 + log_error_errno(errno, "Failed to determine whether /boot/efi exists, assuming no: %m");
37 + log_debug_errno(errno, "/boot/efi: %m");
38 + return (cache = false);
41 static int add_partition_esp(DissectedPartition *p, bool has_xbootldr) {
42 const char *esp_path = NULL, *id = NULL;
43 _cleanup_free_ char *options = NULL;
48 - /* If /boot/ is present, unused, and empty, we'll take that.
49 + /* If /boot/efi is present, unused, and empty, we'll take that.
50 * Otherwise, if /efi/ is unused and empty (or missing), we'll take that.
51 * Otherwise, we do nothing. */
52 - if (!has_xbootldr && slash_boot_exists()) {
53 - r = slash_boot_in_fstab();
54 + if (!has_xbootldr && slash_boot_efi_exists()) {
55 + r = slash_boot_efi_in_fstab();
59 - r = path_is_busy("/boot");
60 + r = path_is_busy("/boot/efi");
65 + esp_path = "/boot/efi";