File 0010-boot-strip-boot-counter-from-boot-entry-id.patch of Package systemd

Commit ID: b768c49df4a100cd05bbae981206f7122261fbe8
Change ID: quntnzkktnyvlprwzyyxyrssqlwkotmn
Author   : Danilo Spinella <danilo.spinella@suse.com> (2025-09-11 10:51:27)
Committer: Danilo Spinella <danilo.spinella@suse.com> (2025-09-11 12:29:26)
Signature: good signature by Danilo Spinella <danilo.spinella@suse.com> 1733BCAC9AF70936

    boot: Strip boot counter from boot entry id

diff --git a/src/boot/boot.c b/src/boot/boot.c
index fc658e49d6..f3386aa46b 100644
--- a/src/boot/boot.c
+++ b/src/boot/boot.c
@@ -1165,6 +1165,11 @@
         if (!strcaseeq16(counter, suffix))
                 return;
 
+        entry->id = xasprintf("%.*ls%ls",
+                        (int) prefix_len - 1,
+                        file,
+                        suffix);
+        strtolower16(entry->id);
         entry->tries_left = tries_left;
         entry->tries_done = tries_done;
         entry->path = xstrdup16(path);
@@ -1395,13 +1400,16 @@
         }
 
         entry->device = device;
-        entry->id = xstrdup16(file);
-        strtolower16(entry->id);
-
-        config_add_entry(config, entry);
 
         if (path)
                 boot_entry_parse_tries(entry, path, file, u".conf");
+
+        if (!entry->id) {
+                entry->id = xstrdup16(file);
+        }
+        strtolower16(entry->id);
+
+        config_add_entry(config, entry);
         TAKE_PTR(entry);
 }
 
openSUSE Build Service is sponsored by