mirror of
https://github.com/edera-dev/sprout.git
synced 2026-11-04 19:02:20 +00:00
fix(entries): stamp the sort key of entries
The sort-key of an entry was compared as written, without stamping the values into it. Autoconfigured Linux entries all use "$kernel" as the sort key, so they compared equal and kept the order the filesystem listed them in, which made the default kernel arbitrary instead of the newest one. Stamp the sort key along with the title.
This commit is contained in:
1 parent
9fa57ee197
commit
ac69037111
2 files changed
+12
-1
No files matched your search
@@ -74,6 +74,16 @@ impl BootableEntry {
|
||||
self.title = self.context.stamp(&self.title);
|
||||
}
|
||||
|
||||
/// Restamp the declared sort key with the current context.
|
||||
/// A sort key that was set on this entry directly is left as is.
|
||||
pub fn restamp_sort_key(&mut self) {
|
||||
if self.sort_key.is_none()
|
||||
&& let Some(ref sort_key) = self.declaration.sort_key
|
||||
{
|
||||
self.sort_key = Some(self.context.stamp(sort_key));
|
||||
}
|
||||
}
|
||||
|
||||
/// Mark this entry as the default entry.
|
||||
pub fn mark_default(&mut self) {
|
||||
self.default = true;
|
||||
|
||||
@@ -271,8 +271,9 @@ fn run() -> Result<()> {
|
||||
.freeze();
|
||||
// Provide the new context to the bootable entry.
|
||||
entry.swap_context(context);
|
||||
// Restamp the title with any values.
|
||||
// Restamp the title and sort key with any values.
|
||||
entry.restamp_title();
|
||||
entry.restamp_sort_key();
|
||||
|
||||
// Mark this entry as the default entry if it is declared as such.
|
||||
if let Some(ref default_entry) = config.options.default_entry {
|
||||
|
||||
Reference in new issue
Block a user