Dear maintainers,

Please accept attached patch that should fix this behavior.

I am using coreutils sort to sort the list by version. As it is turning
this:

/dev/sdb5:/dev/sdb5::/boot/vmlinuz-4.10.0-0.rc2.git2.1.fc26.x86_64:/boot/initramfs-4.10.0-0.rc2.git2.1.fc26.x86_64.img:root=/dev/sdb5
/dev/sdb5:/dev/sdb5::/boot/vmlinuz-4.11.0-2.fc26.x86_64:/boot/initramfs-4.11.0-2.fc26.x86_64.img:root=/dev/sdb5
/dev/sdb5:/dev/sdb5::/boot/vmlinuz-4.9.0-0.rc0.git7.1.fc26.x86_64:/boot/initramfs-4.9.0-0.rc0.git7.1.fc26.x86_64.img:root=/dev/sdb5

Into this

/dev/sdb5:/dev/sdb5::/boot/vmlinuz-4.11.0-2.fc26.x86_64:/boot/initramfs-4.11.0-2.fc26.x86_64.img:root=/dev/sdb5
/dev/sdb5:/dev/sdb5::/boot/vmlinuz-4.10.0-0.rc2.git2.1.fc26.x86_64:/boot/initramfs-4.10.0-0.rc2.git2.1.fc26.x86_64.img:root=/dev/sdb5
/dev/sdb5:/dev/sdb5::/boot/vmlinuz-4.9.0-0.rc0.git7.1.fc26.x86_64:/boot/initramfs-4.9.0-0.rc0.git7.1.fc26.x86_64.img:root=/dev/sdb5


That change is necessary for grub2 to keep the most recent kernel in main
menu.


Also, I am not sure how it is working for other distributions, but on
Fedora I am seeing the same description for main menu, as well as
sub-menus. I was thinking that in this case it should return only the most
recent kernel.
From a725d9d91b92aaa3a1a3332824191a03c91bc4e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20Rakitni=C4=8Dan?= <samuel.rakitni...@gmail.com>
Date: Thu, 13 Jul 2017 21:57:48 +0200
Subject: [PATCH] Sort kernels by version in 90fallback, newest first. Closes:
 #741889

---
 linux-boot-probes/mounted/common/90fallback | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-boot-probes/mounted/common/90fallback b/linux-boot-probes/mounted/common/90fallback
index 9ff78e1..5692d90 100755
--- a/linux-boot-probes/mounted/common/90fallback
+++ b/linux-boot-probes/mounted/common/90fallback
@@ -19,7 +19,7 @@ for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \
 	else
 		kernbootpart="$partition"
 	fi
-	for kernfile in $(eval ls "$mpoint$kernpat" 2>/dev/null); do
+	for kernfile in $(eval ls "$mpoint$kernpat" 2>/dev/null | sort -rV); do
 		kernbasefile=$(echo "$kernfile" | sed "s!^$mpoint!!")
 		if [ -f "$kernfile" ] && [ ! -L "$kernfile" ]; then
 			initrdname=$(echo "$kernfile" | sed "s/vmlinu[zx]/initrd\*/")
-- 
2.9.4

Reply via email to