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

Auke Kok sofar at lunar-linux.org
Tue May 24 14:53:36 UTC 2005


Author: sofar
Date: 2005-05-24 14:53:35 +0000 (Tue, 24 May 2005)
New Revision: 14988

Modified:
   moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin
Log:
unmaintainable code -> maintainable.


Modified: moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin
===================================================================
--- moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin	2005-05-24 14:49:17 UTC (rev 14987)
+++ moonbase/trunk/utils/grub/plugin.d/bootloader-grub.plugin	2005-05-24 14:53:35 UTC (rev 14988)
@@ -93,6 +93,13 @@
         debug_msg "grub: Using GRUB_ROOT=\"$GRUB_ROOT\""
 	fi
 
+	print_grub_image()
+	{
+		printf "title   %s\nkernel  %s\nroot    %s\n\n" "$2" \
+			   "$GRUB_BOOT/$1 root=$(map_grub_to_device $GRUB_ROOT) ro devfs=nomount" \
+			   "$GRUB_ROOT"
+	}
+
 	if ! ( grep -q "$1" /boot/grub/menu.lst && grep -q "$1.old" /boot/grub/menu.lst ) ; then
 		IFS_OLD=$IFS
 		export IFS="
@@ -109,10 +116,10 @@
 
 				if (( IMAGE_COUNT == 0 )) ; then
 					if ! grep -q "$1" /boot/grub/menu.lst ; then
-						printf "title   %s\nkernel  %s\nroot    %s\n\n" "$2" "$GRUB_BOOT/$1 root=$(map_grub_to_device $GRUB_ROOT) ro devfs=nomount" "$GRUB_ROOT" "$GRUB_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
+						print_grub_image "$1" "$2" >> /boot/grub/menu.lst.new
 					fi
 				 if [ -f /boot/"$1.old" ] && ! grep -q "$1.old" /boot/grub/menu.lst ; then
-						printf "title   %s\nkernel  %s\nroot    %s\n\n" "$2.old" "$GRUB_BOOT/$1.old root=$(map_grub_to_device $GRUB_ROOT) ro devfs=nomount" "$GRUB_ROOT" "$GRUB_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
+						print_grub_image "$1.old" "$2.old" >> /boot/grub/menu.lst.new
 					fi
 				fi
 				(( IMAGE_COUNT++ ))
@@ -125,10 +132,10 @@
 
 		if (( IMAGE_COUNT == 0 )) ; then
 			if ! grep -q "$1" /boot/grub/menu.lst ; then
-				printf "title   %s\nkernel  %s\nroot    %s\n\n" "$2" "$GRUB_BOOT/$1 root=$(map_grub_to_device $GRUB_ROOT) ro devfs=nomount" "$GRUB_ROOT" "$GRUB_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
+				print_grub_image "$1" "$2" >> /boot/grub/menu.lst.new
 			fi
 			if [ -f /boot/"$1.old" ] && ! grep -q "$1.old" /boot/grub/menu.lst ; then
-				printf "title   %s\nkernel  %s\nroot    %s\n\n" "$2.old" "$GRUB_BOOT/$1.old root=$(map_grub_to_device $GRUB_ROOT) ro devfs=nomount" "$GRUB_ROOT" "$GRUB_IMAGE_ENTRY" >> /boot/grub/menu.lst.new
+				print_grub_image "$1.old" "$2.old" >> /boot/grub/menu.lst.new
 			fi
 		fi
 



More information about the Lunar-commits mailing list