mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-05 00:12:20 +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.
|
// Apply bootloader interface default entry settings.
|
||||||
if let Some(ref bootloader_interface_default_entry) = bootloader_interface_default_entry {
|
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.
|
if entries
|
||||||
for entry in &mut entries {
|
.iter()
|
||||||
// Mark the entry as the default entry if it matches the specified entry.
|
.any(|entry| entry.is_match(bootloader_interface_default_entry))
|
||||||
// If the entry does not match the specified entry, unmark it as the default entry.
|
{
|
||||||
if entry.is_match(bootloader_interface_default_entry) {
|
// Iterate over all the entries and mark the default entry as the one specified.
|
||||||
entry.mark_default();
|
for entry in &mut entries {
|
||||||
} else {
|
// Mark the entry as the default entry if it matches the specified entry.
|
||||||
entry.unmark_default();
|
// 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