]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
- look-up crypttab in is_luks() too, active LUKS device is not examined any
authorJacek Konieczny <jajcus@pld-linux.org>
Mon, 5 Dec 2011 19:52:18 +0000 (19:52 +0000)
committerJacek Konieczny <jajcus@pld-linux.org>
Mon, 5 Dec 2011 19:52:18 +0000 (19:52 +0000)
  more (the underlaying device is still checked with 'cryptsetup isLuks')

svn-id: @12443

mod-luks.sh

index f58310ad43c44ffc4aa03de5800ff05b395a16bf..890be2c976df0409b37792c5c370bf536afdbb9d 100644 (file)
@@ -32,31 +32,18 @@ is_luks() {
                return 1
        fi
 
-       if [ ! -e "$node" ]; then
-               warn "is_luks(): node $node doesn't exist!"
-               return 1
-       fi
-
-       local dev dm_status dm_name=${node#/dev/mapper/}
+       local dev dm_name=${node#/dev/mapper/}
        if [ "$node" = "$dm_name" ]; then
                debug "is_luks: $node is not device mapper name"
                return 1
        fi
-
-       dev=$(/sbin/cryptsetup status $dm_name 2>/dev/null | awk '/device:/{print $2}')
+       
+       dev=$(awk '$1 == "'"$dm_name"'" { print $2 }' /etc/crypttab)
        if [ "$dev" ]; then
                /sbin/cryptsetup isLuks $dev
                rc=$?
        else
-               # 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
+               rc=1
        fi
 
        if [ $rc = 0 ]; then
This page took 0.370752 seconds and 4 git commands to generate.