|
Harald Hoyer |
368a0c |
From 968280e37053bceab47183e5aa9e7bfb34e73d37 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
368a0c |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
368a0c |
Date: Mon, 13 Jul 2015 10:39:07 +0200
|
|
Harald Hoyer |
368a0c |
Subject: [PATCH] crypt: skip crypttab entries with the same device
|
|
Harald Hoyer |
368a0c |
|
|
Harald Hoyer |
368a0c |
It was only checked, if the name of the crypttab entry matched.
|
|
Harald Hoyer |
368a0c |
This patch adds checking, if the device matches.
|
|
Harald Hoyer |
368a0c |
---
|
|
Harald Hoyer |
368a0c |
modules.d/90crypt/crypt-lib.sh | 6 ++++++
|
|
Harald Hoyer |
368a0c |
modules.d/90crypt/crypt-run-generator.sh | 2 +-
|
|
Harald Hoyer |
368a0c |
2 files changed, 7 insertions(+), 1 deletion(-)
|
|
Harald Hoyer |
368a0c |
|
|
Harald Hoyer |
368a0c |
diff --git a/modules.d/90crypt/crypt-lib.sh b/modules.d/90crypt/crypt-lib.sh
|
|
Harald Hoyer |
368a0c |
index 213003e..2e13da2 100755
|
|
Harald Hoyer |
368a0c |
--- a/modules.d/90crypt/crypt-lib.sh
|
|
Harald Hoyer |
368a0c |
+++ b/modules.d/90crypt/crypt-lib.sh
|
|
Harald Hoyer |
368a0c |
@@ -5,11 +5,17 @@ command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
|
Harald Hoyer |
368a0c |
# check if the crypttab contains an entry for a LUKS UUID
|
|
Harald Hoyer |
368a0c |
crypttab_contains() {
|
|
Harald Hoyer |
368a0c |
local luks="$1"
|
|
Harald Hoyer |
368a0c |
+ local dev="$2"
|
|
Harald Hoyer |
368a0c |
local l d rest
|
|
Harald Hoyer |
368a0c |
if [ -f /etc/crypttab ]; then
|
|
Harald Hoyer |
368a0c |
while read l d rest || [ -n "$l" ]; do
|
|
Harald Hoyer |
368a0c |
strstr "${l##luks-}" "${luks##luks-}" && return 0
|
|
Harald Hoyer |
368a0c |
strstr "$d" "${luks##luks-}" && return 0
|
|
Harald Hoyer |
368a0c |
+ if [ -n "$dev" ]; then
|
|
Harald Hoyer |
368a0c |
+ for _dev in "$(devnames $d)"; do
|
|
Harald Hoyer |
368a0c |
+ [ "$dev" -ef "$_dev" ] && return 0
|
|
Harald Hoyer |
368a0c |
+ done
|
|
Harald Hoyer |
368a0c |
+ fi
|
|
Harald Hoyer |
368a0c |
done < /etc/crypttab
|
|
Harald Hoyer |
368a0c |
fi
|
|
Harald Hoyer |
368a0c |
return 1
|
|
Harald Hoyer |
368a0c |
diff --git a/modules.d/90crypt/crypt-run-generator.sh b/modules.d/90crypt/crypt-run-generator.sh
|
|
Harald Hoyer |
368a0c |
index 3c5d7b1..5bf60ec 100755
|
|
Harald Hoyer |
368a0c |
--- a/modules.d/90crypt/crypt-run-generator.sh
|
|
Harald Hoyer |
368a0c |
+++ b/modules.d/90crypt/crypt-run-generator.sh
|
|
Harald Hoyer |
368a0c |
@@ -6,7 +6,7 @@ type crypttab_contains >/dev/null 2>&1 || . /lib/dracut-crypt-lib.sh
|
|
Harald Hoyer |
368a0c |
dev=$1
|
|
Harald Hoyer |
368a0c |
luks=$2
|
|
Harald Hoyer |
368a0c |
|
|
Harald Hoyer |
368a0c |
-crypttab_contains "$luks" && exit 0
|
|
Harald Hoyer |
368a0c |
+crypttab_contains "$luks" "$dev" && exit 0
|
|
Harald Hoyer |
368a0c |
|
|
Harald Hoyer |
368a0c |
allowdiscards="-"
|
|
Harald Hoyer |
368a0c |
|