crypt: skip crypttab entries with the same device
It was only checked, if the name of the crypttab entry matched. This patch adds checking, if the device matches.master
parent
8c7dc032f8
commit
968280e370
|
@ -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
|
||||
|
|
|
@ -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="-"
|
||||
|
||||
|
|
Loading…
Reference in New Issue