Bug#342221: New patch
Kristian Edlund
edlund at groenstue.dk
Fri Jan 6 09:51:07 UTC 2006
Since the last part only partly solved one of the problems. here is a
new patch that actually solves both problems. My test list of kernels is
sorted:
/boot/vmlinuz-2.6.15
/boot/vmlinuz-2.6.14.2+pre2
/boot/vmlinuz-2.6.14.2-ac99
/boot/vmlinuz-2.6.14.2pre2
/boot/vmlinuz-2.6.14.2-pre2
/boot/vmlinuz-2.6.14-ac99
/boot/vmlinuz-2.6.14pre2
/boot/vmlinuz-2.6.14-pre2
/boot/vmlinuz-2.6.14
The +pre2 is put in the top since it does not understand it and
therefore is treated as an unknown.
I have attached the patch
Kristian
-------------- next part --------------
--- update-grub.orig 2006-01-05 16:44:42.000000000 +0100
+++ update-grub 2006-01-06 10:41:43.000000000 +0100
@@ -445,13 +445,23 @@
# 0 if A==B
# 1 if A>B
# This compares version numbers of the form
-# 2.4.14-random > 2.4.14-ac10 > 2.4.14 > 2.4.14-pre2 >
+# 2.4.14.2 > 2.4.14
+# 2.4.14random = 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 ones without
+ #First a space is put after the version number
+ v1=$(echo $1 | sed -e 's!^\(.*-\([0-9]\+\.\)\{2,3\}[0-9]\+\)\(.*\)!\1 \3!g')
+ v2=$(echo $2 | sed -e 's!^\(.*-\([0-9]\+\.\)\{2,3\}[0-9]\+\)\(.*\)!\1 \3!g')
+ #If the version number only has 3 digits then put in another .0
+ v1=$(echo $v1 | sed -e 's!^\(.*-\([0-9]\+\.\)\{2\}[0-9]\+\)\( .*\)!\1.0 \3!g')
+ v2=$(echo $v2 | 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