feat(boot): introduce sort keys, which are sorted in reverse order, to make boot order more configurable (#55)

This commit is contained in:
alex authored and GitHub committed 2025-12-21 14:11:26 -08:00
1 parent d50f22a386
commit 6a57c72869
6 files changed
+40 -6

No files matched your search

+5
View File
@@ -7,6 +7,7 @@ use crate::context::{RootContext, SproutContext};
use crate::entries::BootableEntry;
use crate::options::SproutOptions;
use crate::phases::phase;
use crate::utils::vercmp::compare_versions;
use alloc::collections::BTreeMap;
use alloc::format;
use alloc::string::ToString;
@@ -257,6 +258,10 @@ fn run() -> Result<()> {
}
}
// Sort the entries by their sort key, finalizing the order to show entries. This happens
// in reverse order so that entries that would come last show up first in the menu.
entries.sort_by(|a, b| compare_versions(a.sort_key(), b.sort_key()).reverse());
// Tell the bootloader interface what entries are available.
BootloaderInterface::set_entries(entries.iter().map(|entry| entry.name()))
.context("unable to set entries in bootloader interface")?;