[Lunar-commits] r18169 - moonbase/trunk/utils/lilo/plugin.d

Auke Kok sofar at lunar-linux.org
Tue Jan 17 20:00:34 UTC 2006


Author: sofar
Date: 2006-01-17 20:00:31 +0000 (Tue, 17 Jan 2006)
New Revision: 18169

Modified:
   moonbase/trunk/utils/lilo/plugin.d/bootloader-lilo.plugin
Log:
grep matches partial strings, always always use 'grep -w' when doing blunt greps.


Modified: moonbase/trunk/utils/lilo/plugin.d/bootloader-lilo.plugin
===================================================================
--- moonbase/trunk/utils/lilo/plugin.d/bootloader-lilo.plugin	2006-01-17 18:47:57 UTC (rev 18168)
+++ moonbase/trunk/utils/lilo/plugin.d/bootloader-lilo.plugin	2006-01-17 20:00:31 UTC (rev 18169)
@@ -18,6 +18,7 @@
 	fi
 	debug_msg "plugin_kernel_updatebootloader_lilo ($@)"
 
+    # only add the new image lines if needed
 	if ! ( grep -q "$1" /etc/lilo.conf && grep -q "$1.old" /etc/lilo.conf ) ; then
 		IFS_OLD=$IFS
 		export IFS="
@@ -28,12 +29,14 @@
 		(( IMAGE_COUNT=0 ))
 		for LINE in $(cat /etc/lilo.conf) ; do
 			if echo $LINE | grep -q "image" || echo $LINE | grep -q "other" ; then
+				# insert space between image/other lines
 				echo >> /etc/lilo.conf.new
 				if (( IMAGE_COUNT == 0 )) ; then
-					if ! grep -q "$1" /etc/lilo.conf ; then
+					# insert new image first
+					if ! grep -qw "$1" /etc/lilo.conf ; then
 						printf "\nimage = %s\n    label = %s\n    read-only\n\n" "/boot/$1" "$2" >> /etc/lilo.conf.new
-				fi
-					if [ -f "/boot/$1.old" ] && ! grep -q "$1.old" /etc/lilo.conf ; then
+					fi
+					if [ -f "/boot/$1.old" ] && ! grep -qw "$1.old" /etc/lilo.conf ; then
 						printf "\nimage = %s\n    label = %s\n    read-only\n\n"  "/boot/$1.old" "$2.old" >> /etc/lilo.conf.new
 					fi
 				fi



More information about the Lunar-commits mailing list