Bug#266243: remove need for awk

Jason Thomas Jason Thomas <jason@debian.org>, 266243@bugs.debian.org
Wed, 18 Aug 2004 16:06:06 +1000


--oLBj+sq0vYjzfsbl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

tags 266243 + patch
thanks

Heres a patch to remove the use of awk

-- 
Jason

"I hope you learn speaking English proper I hope speak I me you."
     -- Branden Robinson, 2001

--oLBj+sq0vYjzfsbl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="grub_update-grub_remove_awk.diff"

diff -Naur grub-0.95+cvs20040624.orig/debian/update-grub grub-0.95+cvs20040624/debian/update-grub
--- grub-0.95+cvs20040624.orig/debian/update-grub	2004-08-18 16:01:27.000000000 +1000
+++ grub-0.95+cvs20040624/debian/update-grub	2004-08-18 16:05:22.000000000 +1000
@@ -62,11 +62,14 @@
 	# Autodetect current root device
 	device=
 	if [ -f /etc/fstab ] ; then
-		script='
-			/^#/ { next }
-			$2 == "'"$mount_point"'" { print $1 ; exit }
-			'
-		device=`awk "$script" /etc/fstab`
+		while read DEV MNT FOO; do
+			if [ `echo "$DEV" | grep -q "^#"` ]; then
+				continue
+			fi
+			if [ "$MNT" = "$mount_point" ]; then
+				device="$DEV";
+			fi
+		done < /etc/fstab
 	fi
 
 	if [ -n "$device" ] ; then

--oLBj+sq0vYjzfsbl--