]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: only do boot counting management for some menu entries
authorLennart Poettering <lennart@poettering.net>
Tue, 25 Feb 2025 11:16:10 +0000 (12:16 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 25 Feb 2025 20:14:27 +0000 (21:14 +0100)
Let's do boot counting only for some menu entry types, and carefully
list which types those are.

src/boot/boot.c

index 1308c83648ac658a034eb8ad671af72251a3c069..410021ebeeef983f656770aeee0646bdda3c2b00 100644 (file)
@@ -70,6 +70,9 @@ typedef enum LoaderType {
 /* Which loader types shall be considered for automatic selection */
 #define LOADER_TYPE_MAY_AUTO_SELECT(t) IN_SET(t, LOADER_EFI, LOADER_LINUX, LOADER_UKI, LOADER_UKI_URL, LOADER_TYPE2_UKI)
 
+/* Whether to do boot attempt counting logic (only works if userspace can actually find the selected option later) */
+#define LOADER_TYPE_BUMP_COUNTERS(t) IN_SET(t, LOADER_LINUX, LOADER_UKI, LOADER_TYPE2_UKI)
+
 typedef struct BootEntry {
         char16_t *id;         /* The unique identifier for this entry (typically the filename of the file defining the entry, possibly suffixed with a profile id) */
         char16_t *id_without_profile; /* same, but without any profile id suffixed */
@@ -1152,6 +1155,9 @@ static EFI_STATUS boot_entry_bump_counters(BootEntry *entry) {
 
         assert(entry);
 
+        if (!LOADER_TYPE_BUMP_COUNTERS(entry->type))
+                return EFI_SUCCESS;
+
         if (entry->tries_left < 0)
                 return EFI_SUCCESS;