SVN: geninitrd/trunk/mod-luks.sh
jajcus
jajcus at pld-linux.org
Mon Dec 5 19:20:26 CET 2011
Author: jajcus
Date: Mon Dec 5 19:20:26 2011
New Revision: 12439
Modified:
geninitrd/trunk/mod-luks.sh
Log:
- magic to get the LUKS lower level device name when initialized with old cryptsetup
Modified: geninitrd/trunk/mod-luks.sh
==============================================================================
--- geninitrd/trunk/mod-luks.sh (original)
+++ geninitrd/trunk/mod-luks.sh Mon Dec 5 19:20:26 2011
@@ -77,6 +77,15 @@
local name=${devpath#/dev/mapper/}
LUKSDEV=$(/sbin/cryptsetup status $name 2>/dev/null | awk '/device:/{print $2}')
if [ -z "$LUKSDEV" ]; then
+ # could be initialized by old cryptsetup, we need some magic
+ vars=$(dmsetup deps lolek_crypt | awk '/dependencies.*(.*)/ { left=index($0, "("); right=index($0, ")"); split(substr($0, left + 1, right - left - 1), A, " *, *") ; print "major=" A[1] "; minor=" A[2] }')
+ eval "$vars"
+ if [ -n "$major" -a -n "$minor" ] ; then
+ LUKSDEV=$(awk "\$1 == $major && \$2 == $minor { print \"/dev/\" \$4 }" /proc/partitions)
+ fi
+
+ fi
+ if [ -z "$LUKSDEV" ]; then
die "Lost cryptsetup device meanwhile?"
fi
More information about the pld-cvs-commit
mailing list