Bug#342221: Patch
Kristian Edlund
edlund at groenstue.dk
Thu Dec 8 03:38:47 UTC 2005
I made a patch that I think will sort the kernels correctly.
When comparing the kernel version if the kernel looks like
vmlinuz-2.6.14-pre2 it will change it to vmlinuz-2.6.14.0-pre2
thereby ensuring that 2.6.14.2 is treated as newer since 2>0 and
therefore it is placed higher in the menu than 2.6.14
This patch will close #264312 and #342221
Kristian
====
--- grub-0.97/debian/update-grub.orig 2005-12-08 04:23:53.000000000 +0100
+++ grub-0.97/debian/update-grub 2005-12-08 04:24:57.000000000 +0100
@@ -436,13 +436,20 @@
# 0 if A==B
# 1 if A>B
# This compares version numbers of the form
+# 2.4.14.2 > 2.4.14
# 2.4.14-random > 2.4.14-ac10 > 2.4.14 > 2.4.14-pre2 >
# 2.4.14-pre1 > 2.4.13-ac99
CompareVersions()
{
- # First split the version number and remove any '.' 's or dashes
- v1=$(echo $1 | sed -e 's![-\.]\+! !g' -e 's![\.\-]!!g')
- v2=$(echo $2 | sed -e 's![-\.]\+! !g' -e 's![\.\-]!!g')
+
+ #Changes the line something-x.y.z into somthing-x.y.z.q
+ #This is to ensure that kernels with a .q is treated as higher than the once without
+ v1=$(echo $1 | sed -e 's!\(^.*-\([0-9]\+\.\)\{2\}[0-9]\+\)\(-\|$\)!\1.0\3!g')
+ v2=$(echo $2 | sed -e 's!\(^.*-\([0-9]\+\.\)\{2\}[0-9]\+\)\(-\|$\)!\1.0\3!g')
+
+ # Then split the version number and remove any '.' 's or dashes
+ v1=$(echo $v1 | sed -e 's![-\.]\+! !g' -e 's![\.\-]!!g')
+ v2=$(echo $v2 | sed -e 's![-\.]\+! !g' -e 's![\.\-]!!g')
# we weight different kernel suffixes here
# ac = 50
More information about the Pkg-grub-devel
mailing list