mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-05 01:52:21 +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
+12
@@ -325,6 +325,10 @@ 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 {
|
||||||
|
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.
|
// Iterate over all the entries and mark the default entry as the one specified.
|
||||||
for entry in &mut entries {
|
for entry in &mut entries {
|
||||||
// Mark the entry as the default entry if it matches the specified entry.
|
// Mark the entry as the default entry if it matches the specified entry.
|
||||||
@@ -335,6 +339,14 @@ fn run() -> Result<()> {
|
|||||||
entry.unmark_default();
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply bootloader interface oneshot entry settings.
|
// Apply bootloader interface oneshot entry settings.
|
||||||
|
|||||||
Reference in new issue
Block a user