]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
Fallback detection if device is crypted.
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Mon, 5 Dec 2011 08:25:54 +0000 (08:25 +0000)
committerArkadiusz Miśkiewicz <arekm@maven.pl>
Mon, 5 Dec 2011 08:25:54 +0000 (08:25 +0000)
svn-id: @12438

mod-luks.sh

index d1f1a0e9816845acd947cd1c1683ff2e1b76f810..45cd7ae55a01097dda7e5f33db08e530f9d2e4ec 100644 (file)
@@ -37,7 +37,7 @@ is_luks() {
                return 1
        fi
 
-       local dev dm_name=${node#/dev/mapper/}
+       local dev dm_status dm_name=${node#/dev/mapper/}
        if [ "$node" = "$dm_name" ]; then
                debug "is_luks: $node is not device mapper name"
                return 1
@@ -48,7 +48,15 @@ is_luks() {
                /sbin/cryptsetup isLuks $dev
                rc=$?
        else
-               rc=1
+               # If luks partition was activated using old cryptsetup (at initrd level)
+               # then "device:" report could be missing from cryptsetup status above.
+               # Fallback to dmsetup report in such case.
+               dm_status=$(/sbin/dmsetup status --target crypt $dm_name 2>/dev/null)
+               if [ -n "$dm_status" ]; then
+                       rc=0
+               else
+                       rc=1
+               fi
        fi
 
        if [ $rc = 0 ]; then
This page took 0.037172 seconds and 4 git commands to generate.