Bug#215116: grub: (patch) LABEL=, UUID= and update-grub

Conny Brunnkvist Conny Brunnkvist <kop@ninzin.net>, 215116@bugs.debian.org
Sat, 17 Apr 2004 12:48:12 +0200


This is a multi-part MIME message sent by reportbug.

--===============0867572675==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: grub
Version: 0.93+cvs20031021-8
Severity: normal
Followup-For: Bug #215116

(update-grub_UUID+LABEL.diff)
Here is another way of solving the problem with update-grub and LABEL/UUID
declarations in fstab. My first thought was to use "findfs" to lookup the 
block devices, but it's only included in the e2fsprogs package. 
The program "blkid" from package libblkid1 seemed more appropriate - it 
still makes a dependency, but at least it's sort of a lesser common 
denominator than to depend on e2fsprogs (e2fsprogs itself pre-depends on libblkid1).
On the other hand, e2fsprogs is in base/required... Oh well.

(update-grub_prog.diff)
I also replaced an undeclared variable called "$PROG"; perhaps some 
policy I'm unaware of externally defines that one, otherwise it's probably 
just a leftover?

//conny

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (700, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.4-1-686
Locale: LANG=sv_SE, LC_CTYPE=sv_SE

Versions of packages grub depends on:
ii  libc6                       2.3.2.ds1-11 GNU C Library: Shared libraries an
ii  libncurses5                 5.4-3        Shared libraries for terminal hand

-- no debconf information

--===============0867572675==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="update-grub_UUID+LABEL.diff"

--- update-grub.orig	2004-04-17 12:41:07.000000000 +0200
+++ update-grub	2004-04-17 12:41:50.000000000 +0200
@@ -69,8 +69,13 @@
 		device=`awk "$script" /etc/fstab`
 	fi
 
+	volume_id=`echo "$device" | egrep "^(UUID=|LABEL=)"` || true
+	if [ -n "$volume_id" ] ; then
+		device=`blkid -t $volume_id | cut -f1 -d:`
+	fi
+
 	if [ -n "$device" ] ; then
-		device=`readlink -f "$device"`
+		device=`readlink -f "$device" ` || true
 	fi
 
 	echo $device

--===============0867572675==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="update-grub_prog.diff"

--- update-grub.orig	2004-04-17 12:41:07.000000000 +0200
+++ update-grub	2004-04-17 12:43:32.000000000 +0200
@@ -81,7 +81,7 @@
 	device=$(find_device "/")
 
 	if [ -z "$device" ]; then
-		echo "$PROG: Cannot determine root device.  Assuming /dev/hda1" >&2
+		echo "update-grub: Cannot determine root device.  Assuming /dev/hda1" >&2
 		echo "This error is probably caused by an invalid /etc/fstab" >&2
 		device=/dev/hda1
 	fi

--===============0867572675==--