mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 19:52:22 +00:00
fix(main): ignore a LoaderEntryDefault that matches no entry
When LoaderEntryDefault was set, every entry that didn't match it was unmarked as the default, including the one set by default-entry. If the variable named an entry that no longer exists, such as a removed kernel, the configured default was lost and the first entry booted instead. Only apply the variable when some entry matches it.
This commit is contained in:
1 parent
2b5cc4e70f
commit
20ca279fca
1 file changed
+20
-8
+20
-8
@@ -325,15 +325,27 @@ fn run() -> Result<()> {
|
||||
|
||||
// Apply bootloader interface default entry settings.
|
||||
if let Some(ref bootloader_interface_default_entry) = bootloader_interface_default_entry {
|
||||
// Iterate over all the entries and mark the default entry as the one specified.
|
||||
for entry in &mut entries {
|
||||
// Mark the entry as the default entry if it matches the specified entry.
|
||||
// If the entry does not match the specified entry, unmark it as the default entry.
|
||||
if entry.is_match(bootloader_interface_default_entry) {
|
||||
entry.mark_default();
|
||||
} else {
|
||||
entry.unmark_default();
|
||||
if entries
|
||||
.iter()
|
||||
.any(|entry| entry.is_match(bootloader_interface_default_entry))
|
||||
{
|
||||
// Iterate over all the entries and mark the default entry as the one specified.
|
||||
for entry in &mut entries {
|
||||
// Mark the entry as the default entry if it matches the specified entry.
|
||||
// If the entry does not match the specified entry, unmark it as the default entry.
|
||||
if entry.is_match(bootloader_interface_default_entry) {
|
||||
entry.mark_default();
|
||||
} else {
|
||||
entry.unmark_default();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If no entry matches, such as when the entry was removed, the setting is ignored
|
||||
// so that the configured default entry is still used.
|
||||
warn!(
|
||||
"ignoring bootloader interface default entry '{}': no matching entry",
|
||||
bootloader_interface_default_entry
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user