[Lunar-commits] r15200 - moonbase/trunk/utils/grub/plugin.d

Auke Kok sofar at lunar-linux.org
Wed Jun 1 13:43:31 UTC 2005


Author: sofar
Date: 2005-06-01 13:43:30 +0000 (Wed, 01 Jun 2005)
New Revision: 15200

Modified:
   moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin
Log:
Rewrote this to properly recognize old 'title's and scan properly for them.


Modified: moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin
===================================================================
--- moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin	2005-06-01 13:19:12 UTC (rev 15199)
+++ moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin	2005-06-01 13:43:30 UTC (rev 15200)
@@ -102,18 +102,24 @@
 		echo   "kernel  $GRUB_BOOT/$1 root=$(map_grub_to_device $GRUB_ROOT) ro devfs=nomount"
 		echo   ""
 	}
+
+	has_grub_title()
+	{
+		# really hard way of looking for a kernel label $1
+		grep title "$2" | tr '\t' ' ' | tr -s ' ' | cut -d ' ' -f2- | grep -q "^$1$"
+	}
 	
 	add_grub_image()
 	{
-		if ! grep -qw "$2" /boot/grub/menu.lst ; then
+		if ! has_grub_title "$2" /boot/grub/menu.lst ; then
 			print_grub_image "$1" "$2" >> /boot/grub/menu.lst.new
 		fi
-	 	if [ -f /boot/"$1.old" ] && ! grep -qw "$2.old" /boot/grub/menu.lst ; then
+	 	if [ -f /boot/"$1.old" ] && ! has_grub_title "$2.old" /boot/grub/menu.lst ; then
 			print_grub_image "$1.old" "$2.old" >> /boot/grub/menu.lst.new
 		fi
 	}
 
-	if ! ( grep -qw "$2" /boot/grub/menu.lst && grep -qw "$2.old" /boot/grub/menu.lst ) ; then
+	if ! ( has_grub_title "$2" /boot/grub/menu.lst && has_grub_title "$2.old" /boot/grub/menu.lst ) ; then
 		export IFS="
 "
 



More information about the Lunar-commits mailing list