Bug#240599: symlinked kernels in update-grub

Ilguiz Latypov Ilguiz Latypov <ilatypov@infradead.org>, 240599@bugs.debian.org
Sun, 28 Mar 2004 01:51:34 -0500


Package: grub
Version: 0.93+cvs20031021-8

I recently enabled the link_in_boot option in /etc/kernel-img.conf to
generate vmlinuz and vmlinuz.old symbolic links inside the /boot
partition.  However, the update-grub script produced entries such as

  title           Debian GNU/Linux, kernel             (a)
  root            (hd0,2)
  kernel          /vmlinuz root=/dev/hda4 ro ramdisk_size=16384 
  initrd          /initrd.img
  savedefault
  boot

and

  title           Debian GNU/Linux, kernel .old        (b)
  root            (hd0,2)
  kernel          /vmlinuz.old .old                    (c)
  initrd          /initrd.img.old
  savedefault
  boot

The lines (a), (b) and (c) did not look as expected.  Below is the
suggested fix.  Regards,

-- 
Ilguiz Latypov

tel.  +1 (519) 569-8746
66 Wildlark Crescent
Kitchener, Ontario N2N 3E9

==================================================================
--- /sbin/update-grub.orig	2004-01-06 16:08:06.000000000 -0500
+++ /sbin/update-grub	2004-03-28 01:28:31.000000000 -0500
@@ -685,25 +685,26 @@
 		kernel_dir=
 	fi
 
-	kernel=$kernel_dir/$kernelName
+	kernel="$kernel_dir/$kernelName"
+	kernelAbs="/boot/$kernelName"
 	if [ -n "$initrdName" ] ; then
 		initrd=$kernel_dir/$initrdName
 	fi
 
 	echo "Found kernel: $kernel"
 
-	if [ "$kernelVersion" = "vmlinuz" ]; then
-		if [ -L "/boot/$kernelVersion" ]; then
-			kernelVersion=`readlink -f "/boot/$kernelVersion"`
+	if [ "$kernelName" = "vmlinuz" ]; then
+		if [ -L "$kernelAbs" ]; then
+			kernelVersion=`readlink -f "$kernelAbs"`
 			kernelVersion=$(echo $kernelVersion | sed -e 's/.*vmlinuz-//')
 			kernelVersion="$kernelVersion Default"
 		else
 			kernelVersion="Default"
 		fi
 	fi
-	if [ "$kernelVersion" = "vmlinuz.old" ]; then
-		if [ -L "/boot/$kernelVersion" ]; then
-			kernelVersion=`readlink -f "/boot/$kernelVersion"`
+	if [ "$kernelName" = "vmlinuz.old" ]; then
+		if [ -L "$kernelAbs" ]; then
+			kernelVersion=`readlink -f "$kernelAbs"`
 			kernelVersion=$(echo $kernelVersion | sed -e 's/.*vmlinuz-//')
 			kernelVersion="$kernelVersion Previous"
 		else
==================================================================