r2376 - in trunk/utils/initrd-tools: . debian

Martin Michlmayr tbm@costa.debian.org
Sun, 23 Jan 2005 19:36:06 +0100


Author: tbm
Date: 2005-01-23 19:36:05 +0100 (Sun, 23 Jan 2005)
New Revision: 2376

Modified:
   trunk/utils/initrd-tools/debian/changelog
   trunk/utils/initrd-tools/mkinitrd
Log:
The last upload adding support for encrypted root unintentionally
introduced a dependency on dmsetup which breaks installations with root on
LVM.  Explicitly check if dmsetup is available.  Thanks, Joey Hess (Closes:
#291362).


Modified: trunk/utils/initrd-tools/debian/changelog
===================================================================
--- trunk/utils/initrd-tools/debian/changelog	2005-01-23 17:43:22 UTC (rev 2375)
+++ trunk/utils/initrd-tools/debian/changelog	2005-01-23 18:36:05 UTC (rev 2376)
@@ -1,3 +1,13 @@
+initrd-tools (0.1.77) UNRELEASED; urgency=low
+
+  * Martin Michlmayr
+    - The last upload adding support for encrypted root unintentionally
+      introduced a dependency on dmsetup which breaks installations with
+      root on LVM.  Explicitly check if dmsetup is available.  Thanks,
+      Joey Hess (Closes: #291362).
+
+ -- Martin Michlmayr <tbm@cyrius.com>  Sun, 23 Jan 2005 18:34:15 +0000
+
 initrd-tools (0.1.76) unstable; urgency=low
 
   * Joshua Kwan

Modified: trunk/utils/initrd-tools/mkinitrd
===================================================================
--- trunk/utils/initrd-tools/mkinitrd	2005-01-23 17:43:22 UTC (rev 2375)
+++ trunk/utils/initrd-tools/mkinitrd	2005-01-23 18:36:05 UTC (rev 2376)
@@ -390,20 +390,19 @@
 dm() {
 	local dmname
 	
-	if ! command -v dmsetup > /dev/null 2>&1; then
-		echo Root is on a DM device, but dmsetup not installed >&2
-		exit 1
-	fi
+	if command -v dmsetup > /dev/null 2>&1; then
+		dmdev=$(printf "(%d, %d)" $major $minor)
 	
-	dmdev=$(printf "(%d, %d)" $major $minor)
-	
-	if ! dmsetup ls | grep -q "$dmdev\$"; then
-		echo Unknown DM device $major:$minor >&2
-		exit 1
+		if ! dmsetup ls | grep -q "$dmdev\$"; then
+			echo Unknown DM device $major:$minor >&2
+			exit 1
+		fi
+		
+		dmname=$(dmsetup ls | grep "$dmdev\$" | sed 's/^\([^[:space:]]*\).*$/\1/')
 	fi
 	
-	dmname=$(dmsetup ls | grep "$dmdev\$" | sed 's/^\([^[:space:]]*\).*$/\1/')
-	if dmsetup table $dmname | cut -d" " -f3 | grep -q ^crypt$ ; then
+	if [ -n "$dmname" ] && \
+	   dmsetup table $dmname | cut -d" " -f3 | grep -q ^crypt$ ; then
 		dmcrypt
 	elif command -v lvmiopversion > /dev/null 2>&1; then
 		lvm