]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
crypt: skip crypttab entries with the same device
authorHarald Hoyer <harald@redhat.com>
Mon, 13 Jul 2015 08:39:07 +0000 (10:39 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 13 Jul 2015 08:44:27 +0000 (10:44 +0200)
It was only checked, if the name of the crypttab entry matched.
This patch adds checking, if the device matches.

modules.d/90crypt/crypt-lib.sh
modules.d/90crypt/crypt-run-generator.sh

index 213003e0dade78237f8cfc2d5a817b3bcb2197e1..2e13da2e302da1a196a77dbb1a8995f80ebe57a0 100755 (executable)
@@ -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
index 3c5d7b16d622d07d8ad6520bf9cc7308c85b6321..5bf60ecb7b33618a6c9b3ef0bae71f354283142d 100755 (executable)
@@ -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="-"