dracut/backport-fix-crypt-gpg-execute-card-status-on-each-try.patch
hongjinghao 9d9fb131b3 backport patchs from upstream
(cherry picked from commit 74c55dc789a3aacb444c42ab40cd308bd213f5e3)
2024-02-22 16:48:54 +08:00

33 lines
1.2 KiB
Diff

From 6610093698db25fda1d584b9771da1e2c2330095 Mon Sep 17 00:00:00 2001
From: LinkTed <link.ted@mailbox.org>
Date: Mon, 21 Jun 2021 19:15:01 +0200
Subject: [PATCH] fix(crypt-gpg): execute --card-status on each try
If the gpg card is not inserted before the --card-status command is
executed then the public key is not linked with the card. Therefore,
the LUKS partition cannot be decrypted. To solve this, the
--card--status command is executed on each try.
Reference:https://github.com/dracutdevs/dracut/commit/6610093698db25fda1d584b9771da1e2c2330095
Conflict:NA
---
modules.d/91crypt-gpg/crypt-gpg-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/91crypt-gpg/crypt-gpg-lib.sh b/modules.d/91crypt-gpg/crypt-gpg-lib.sh
index 0613803a..88ce16e2 100755
--- a/modules.d/91crypt-gpg/crypt-gpg-lib.sh
+++ b/modules.d/91crypt-gpg/crypt-gpg-lib.sh
@@ -51,7 +51,7 @@ gpg_decrypt() {
fi
ask_for_password \
- --cmd "gpg $opts --decrypt $mntp/$keypath" \
+ --cmd "GNUPGHOME=$gpghome gpg --card-status --no-tty > /dev/null 2>&1; gpg $opts --decrypt $mntp/$keypath" \
--prompt "${inputPrompt:-Password ($keypath on $keydev for $device)}" \
--tries 3 --tty-echo-off
--
2.27.0