fix(autoconfigure/linux): sort kernels by version, newer kernels first

This commit is contained in:
2025-11-01 22:06:48 -04:00
parent 01b3706914
commit 3b4a66879f

View File

@@ -5,6 +5,7 @@ use crate::entries::EntryDeclaration;
use crate::generators::GeneratorDeclaration; use crate::generators::GeneratorDeclaration;
use crate::generators::list::ListConfiguration; use crate::generators::list::ListConfiguration;
use crate::utils; use crate::utils;
use crate::utils::vercmp;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use uefi::CString16; use uefi::CString16;
@@ -170,6 +171,9 @@ pub fn scan(
return Ok(false); return Ok(false);
} }
// Sort the kernel pairs by kernel version, if it has one, newer kernels first.
pairs.sort_by(|a, b| vercmp::compare_versions(&a.kernel, &b.kernel).reverse());
// Generate a unique name for the linux chainload action. // Generate a unique name for the linux chainload action.
let chainload_action_name = format!("{}{}", LINUX_CHAINLOAD_ACTION_PREFIX, root_unique_hash,); let chainload_action_name = format!("{}{}", LINUX_CHAINLOAD_ACTION_PREFIX, root_unique_hash,);