offset="`cryptsetup luksDump $device 2>/dev/null | awk '/^Payload offset/{print $3}'`"
if [ -z "$offset" ]; then
- # Plain dmcrypt
- offset=0
- type=dmcrypt
+ # Plain dmcrypt
+ offset=0
+ type=dmcrypt
else
- type=luks
+ type=luks
fi
cryptdev="`dmcryptmap $device`"
if [ -z "$cryptdev" ]; then
- echo "! Failed to find decrypted mapper device for $device"
- exit 1;
+ echo "! Failed to find decrypted mapper device for $device"
+ exit 1;
fi
cryptsector="`dc -e "$sector $offset - p"`" #`"
echo "device $cryptdev crypt"
echo "type $type"
echo "sector $cryptsector"
-
+
device="$cryptdev"
sector="$cryptsector"