]>
Commit | Line | Data |
---|---|---|
5aac5f1e JP |
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 | |
5003d836 JP |
3 | @@ -487,6 +487,18 @@ |
4 | return cache; | |
5 | } | |
6 | ||
7 | +static int slash_boot_efi_in_fstab(void) { | |
8 | + static int cache = -1; | |
9 | + | |
10 | + if (cache >= 0) | |
11 | + return cache; | |
12 | + | |
13 | + cache = fstab_is_mount_point("/boot/efi"); | |
14 | + if (cache < 0) | |
15 | + return log_error_errno(cache, "Failed to parse fstab: %m"); | |
16 | + return cache; | |
17 | +} | |
18 | + | |
5aac5f1e JP |
19 | static int add_partition_xbootldr(DissectedPartition *p) { |
20 | _cleanup_free_ char *options = NULL; | |
21 | int r; | |
22 | @@ -562,6 +574,21 @@ | |
5003d836 JP |
23 | return (cache = false); |
24 | } | |
25 | ||
26 | +static bool slash_boot_efi_exists(void) { | |
27 | + static int cache = -1; | |
28 | + | |
29 | + if (cache >= 0) | |
30 | + return cache; | |
31 | + | |
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"); | |
36 | + else | |
37 | + log_debug_errno(errno, "/boot/efi: %m"); | |
38 | + return (cache = false); | |
39 | +} | |
40 | + | |
5aac5f1e JP |
41 | static int add_partition_esp(DissectedPartition *p, bool has_xbootldr) { |
42 | const char *esp_path = NULL, *id = NULL; | |
5003d836 | 43 | _cleanup_free_ char *options = NULL; |
5aac5f1e JP |
44 | @@ -582,19 +609,19 @@ |
45 | if (r > 0) | |
5003d836 | 46 | return 0; |
5003d836 JP |
47 | |
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. | |
5aac5f1e | 51 | * Otherwise, we do nothing. */ |
5003d836 JP |
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(); | |
56 | if (r < 0) | |
57 | return r; | |
58 | if (r == 0) { | |
59 | - r = path_is_busy("/boot"); | |
60 | + r = path_is_busy("/boot/efi"); | |
61 | if (r < 0) | |
62 | return r; | |
63 | if (r == 0) { | |
64 | - esp_path = "/boot"; | |
65 | + esp_path = "/boot/efi"; | |
66 | id = "boot"; | |
67 | } | |
5aac5f1e | 68 | } |