It was only checked, if the name of the crypttab entry matched.
This patch adds checking, if the device matches.
# check if the crypttab contains an entry for a LUKS UUID
crypttab_contains() {
local luks="$1"
+ local dev="$2"
local l d rest
if [ -f /etc/crypttab ]; then
while read l d rest || [ -n "$l" ]; do
strstr "${l##luks-}" "${luks##luks-}" && return 0
strstr "$d" "${luks##luks-}" && return 0
+ if [ -n "$dev" ]; then
+ for _dev in "$(devnames $d)"; do
+ [ "$dev" -ef "$_dev" ] && return 0
+ done
+ fi
done < /etc/crypttab
fi
return 1
dev=$1
luks=$2
-crypttab_contains "$luks" && exit 0
+crypttab_contains "$luks" "$dev" && exit 0
allowdiscards="-"