Hi Stephan.

The reason is, that cryptsetups hook scripts do not yet normalise the
different ways to express devices, e.g.
/dev/disk/by-uuid/340d6393-2aef-4a50-8bde-15f047154e4a
in contrast to
UUID=340d6393-2aef-4a50-8bde-15f047154e4a

I've attached an (auto-rejectable ;) ) patch... which should solve this
issue by adding a normalisation function to cryptroot, that is invoked
in - I hope - all places where devices are collected in that script.

Currently I only know about the following synonyms used:
LABEL=foo <=> /dev/disk/by-label/foo
UUID=foo <=> /dev/disk/by-uuid/foo

My current code has the problem that it will fail, should udev ever
decide to use other strings...

Cheers,
Chris.
--- /usr/share/initramfs-tools/hooks/cryptroot	2010-06-01 15:43:18.000000000 +0200
+++ cryptroot	2010-06-16 20:16:43.000000000 +0200
@@ -32,6 +32,16 @@
 	done
 }
 
+normalise_device() {
+	local device
+	device="$1"
+	
+	device="$( printf "%s" "${device}"  |  sed -n 's/^[uU][uU][iI][dD]=/\/dev\/disk\/by-uuid\//' )"
+	device="$( printf "%s" "${device}"  |  sed -n 's/^[lL][aA][bB][eE][lL]=/\/dev\/disk\/by-label\//' )"
+	
+	return "${device}"
+}
+
 get_resume_devices() {
 	local device opt count dupe candidates devices
 	candidates=""
@@ -40,7 +50,7 @@
 
 	# uswsusp
 	if [ -e /etc/uswsusp.conf ]; then
-		device=$(sed -rn 's/^resume device[[:space:]]*[:=][[:space:]]*// p' /etc/uswsusp.conf)
+		device="$( normalise_device "$(sed -rn 's/^resume device[[:space:]]*[:=][[:space:]]*// p' /etc/uswsusp.conf)" )"
 		if [ -n "$device" ]; then
 			candidates="$candidates $device"
 		fi
@@ -48,7 +58,7 @@
 
 	# uswsusp - again...
 	if [ -e /etc/suspend.conf ]; then
-		device=$(sed -rn 's/^resume device[[:space:]]*[:=][[:space:]]*// p' /etc/suspend.conf)
+		device="$( normalise_device "$(sed -rn 's/^resume device[[:space:]]*[:=][[:space:]]*// p' /etc/suspend.conf)" )"
 		if [ -n "$device" ]; then
 			candidates="$candidates $device"
 		fi
@@ -58,7 +68,7 @@
 	for opt in $(cat /proc/cmdline); do
 		case $opt in
 		resume=*)
-			device="${opt#resume=}"
+			device="$( normalise_device "${opt#resume=}" )"
 			candidates="$candidates $device"
 			;;
 		esac
@@ -66,7 +76,7 @@
 
 	# initramfs-tools
 	if [ -e /etc/initramfs-tools/conf.d/resume ]; then
-		device=$(sed -rn 's/^RESUME[[:space:]]*=[[:space:]]*// p' /etc/initramfs-tools/conf.d/resume)
+		device="$( normalise_device "$(sed -rn 's/^RESUME[[:space:]]*=[[:space:]]*// p' /etc/initramfs-tools/conf.d/resume)" )"
 		if [ -n "$device" ]; then
 			candidates="$candidates $device"
 		fi

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to