[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[2473]
From: |
Robert Millan |
Subject: |
[2473] |
Date: |
Fri, 07 Aug 2009 12:05:07 +0000 |
Revision: 2473
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2473
Author: robertmh
Date: 2009-08-07 12:05:06 +0000 (Fri, 07 Aug 2009)
Log Message:
-----------
Split in two commits. This one's the second.
2009-08-07 Robert Millan <address@hidden>
* util/grub.d/10_linux.in (test_numeric): Moved from here ...
* util/grub-mkconfig_lib.in (version_test_numeric): ... to here.
Update all users.
* util/grub.d/10_linux.in (test_gt): Strip any basename prefix,
not just "vmlinu[zx]".
Moved from here ...
* util/grub-mkconfig_lib.in (version_test_gt): ... to here. Update
all users.
* util/grub.d/10_linux.in (find_latest): Moved from here ...
* util/grub-mkconfig_lib.in (version_find_latest): ... to here. Update
all users.
Modified Paths:
--------------
trunk/grub2/util/grub-mkconfig_lib.in
trunk/grub2/util/grub.d/10_linux.in
Modified: trunk/grub2/util/grub-mkconfig_lib.in
===================================================================
--- trunk/grub2/util/grub-mkconfig_lib.in 2009-08-07 12:02:54 UTC (rev
2472)
+++ trunk/grub2/util/grub-mkconfig_lib.in 2009-08-07 12:05:06 UTC (rev
2473)
@@ -176,3 +176,54 @@
fi
return 0
}
+
+version_test_numeric ()
+{
+ local a=$1
+ local cmp=$2
+ local b=$3
+ if [ "$a" = "$b" ] ; then
+ case $cmp in
+ ge|eq|le) return 0 ;;
+ gt|lt) return 1 ;;
+ esac
+ fi
+ if [ "$cmp" = "lt" ] ; then
+ c=$a
+ a=$b
+ b=$c
+ fi
+ if (echo $a ; echo $b) | sort -n | head -n 1 | grep -qx $b ; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+version_test_gt ()
+{
+ local a=`echo $1 | sed -e "s/[^-]*-//g"`
+ local b=`echo $2 | sed -e "s/[^-]*-//g"`
+ local cmp=gt
+ if [ "x$b" = "x" ] ; then
+ return 0
+ fi
+ case $a:$b in
+ *.old:*.old) ;;
+ *.old:*) a=`echo -n $a | sed -e s/\.old$//g` ; cmp=gt ;;
+ *:*.old) b=`echo -n $b | sed -e s/\.old$//g` ; cmp=ge ;;
+ esac
+ version_test_numeric $a $cmp $b
+ return $?
+}
+
+version_find_latest ()
+{
+ local a=""
+ for i in $@ ; do
+ if version_test_gt "$i" "$a" ; then
+ a="$i"
+ fi
+ done
+ echo "$a"
+}
Modified: trunk/grub2/util/grub.d/10_linux.in
===================================================================
--- trunk/grub2/util/grub.d/10_linux.in 2009-08-07 12:02:54 UTC (rev 2472)
+++ trunk/grub2/util/grub.d/10_linux.in 2009-08-07 12:05:06 UTC (rev 2473)
@@ -42,57 +42,6 @@
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
-test_numeric ()
-{
- local a=$1
- local cmp=$2
- local b=$3
- if [ "$a" = "$b" ] ; then
- case $cmp in
- ge|eq|le) return 0 ;;
- gt|lt) return 1 ;;
- esac
- fi
- if [ "$cmp" = "lt" ] ; then
- c=$a
- a=$b
- b=$c
- fi
- if (echo $a ; echo $b) | sort -n | head -n 1 | grep -qx $b ; then
- return 0
- else
- return 1
- fi
-}
-
-test_gt ()
-{
- local a=`echo $1 | sed -e "s/[^-]*-//g"`
- local b=`echo $2 | sed -e "s/[^-]*-//g"`
- local cmp=gt
- if [ "x$b" = "x" ] ; then
- return 0
- fi
- case $a:$b in
- *.old:*.old) ;;
- *.old:*) a=`echo -n $a | sed -e s/\.old$//g` ; cmp=gt ;;
- *:*.old) b=`echo -n $b | sed -e s/\.old$//g` ; cmp=ge ;;
- esac
- test_numeric $a $cmp $b
- return $?
-}
-
-find_latest ()
-{
- local a=""
- for i in $@ ; do
- if test_gt "$i" "$a" ; then
- a="$i"
- fi
- done
- echo "$a"
-}
-
linux_entry ()
{
cat << EOF
@@ -117,7 +66,7 @@
done`
while [ "x$list" != "x" ] ; do
- linux=`find_latest $list`
+ linux=`version_find_latest $list`
echo "Found linux image: $linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
[Prev in Thread] |
Current Thread |
[Next in Thread] |