diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh index 213003e0..2e13da2e 100755 --- a/modules.d/90crypt/crypt-lib.sh +++ b/modules.d/90crypt/crypt-lib.sh @@ -5,11 +5,17 @@ command -v getarg >/dev/null || . /lib/dracut-lib.sh # 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 diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh index 3c5d7b16..5bf60ecb 100755 --- a/modules.d/90crypt/crypt-run-generator.sh +++ b/modules.d/90crypt/crypt-run-generator.sh @@ -6,7 +6,7 @@ type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh dev=$1 luks=$2 -crypttab_contains "$luks" && exit 0 +crypttab_contains "$luks" "$dev" && exit 0 allowdiscards="-"