Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu karmic ubuntu-patch

Hello!

Attached is a patch to solve UUID and LABEL handling, as seen in Ubuntu[1].

Thanks,

-Kees

[1] https://bugs.edge.launchpad.net/bugs/287879

-- 
Kees Cook                                            @debian.org
--- cryptsetup-1.0.6+20090405.svn49~/debian/initramfs/cryptroot-hook	2009-05-10 16:51:44.000000000 -0700
+++ cryptsetup-1.0.6+20090405.svn49/debian/initramfs/cryptroot-hook	2009-04-09 19:59:00.000000000 -0700
@@ -280,7 +280,7 @@
 }
 
 canonical_device() {
-	local dev altdev
+	local dev altdev original
 	dev="$1"
 
 	altdev="${dev#LABEL=}"
@@ -293,6 +293,7 @@
 		dev="/dev/disk/by-uuid/$altdev"
 	fi
 
+	original=$dev
 	if [ -h "$dev" ]; then
 		dev=$(readlink -e "$dev")
 	fi
@@ -301,6 +302,11 @@
 	if [ "$altdev" != "$dev" ]; then
 		echo "$altdev"
 		return 0
+	elif [ "x${original%/dev/disk/by-*/*}" = "x" ]; then
+		# support crypttab UUID/LABEL entries
+		# this is a /dev/disk/by-*/ path so return just the 'basename'
+		echo "${original##/dev/disk/by-*/}"
+		return 0
 	fi
 
 	return 1

Reply via email to