boot: Strip boot counter from entry id

When boot counter is found in the boot entry filename, strip it from the
id to match bootctl id.

Fixes #38813.
This commit is contained in:
Danilo Spinella
2025-09-11 10:51:27 +02:00
committed by Luca Boccassi
parent ff33c8f87d
commit 4301ad00ef

View File

@@ -1165,6 +1165,10 @@ static void boot_entry_parse_tries(
if (!strcaseeq16(counter, suffix))
return;
entry->id = xasprintf("%.*ls%ls",
(int) prefix_len - 1,
file,
suffix);
entry->tries_left = tries_left;
entry->tries_done = tries_done;
entry->directory = xstrdup16(directory);
@@ -1395,13 +1399,16 @@ static void boot_entry_add_type1(
}
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);
}