|
|
|
@ -29,8 +29,10 @@ gpg_decrypt() {
@@ -29,8 +29,10 @@ gpg_decrypt() {
|
|
|
|
|
# program needed with GnuPG < 2.1), making for uncomplicated |
|
|
|
|
# integration with the existing codebase. |
|
|
|
|
local useSmartcard="0" |
|
|
|
|
local gpgMajorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')" |
|
|
|
|
local gpgMinorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')" |
|
|
|
|
local gpgMajorVersion |
|
|
|
|
local gpgMinorVersion |
|
|
|
|
gpgMajorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')" |
|
|
|
|
gpgMinorVersion="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')" |
|
|
|
|
|
|
|
|
|
if [ "${gpgMajorVersion}" -ge 2 ] && [ "${gpgMinorVersion}" -ge 1 ] \ |
|
|
|
|
&& [ -f /root/crypt-public-key.gpg ] && getargbool 1 rd.luks.smartcard; then |
|
|
|
@ -38,7 +40,8 @@ gpg_decrypt() {
@@ -38,7 +40,8 @@ gpg_decrypt() {
|
|
|
|
|
echo "allow-loopback-pinentry" >> "$gpghome/gpg-agent.conf" |
|
|
|
|
GNUPGHOME="$gpghome" gpg-agent --quiet --daemon |
|
|
|
|
GNUPGHOME="$gpghome" gpg --quiet --no-tty --import < /root/crypt-public-key.gpg |
|
|
|
|
local smartcardSerialNumber="$(GNUPGHOME=$gpghome gpg --no-tty --card-status \ |
|
|
|
|
local smartcardSerialNumber |
|
|
|
|
smartcardSerialNumber="$(GNUPGHOME=$gpghome gpg --no-tty --card-status \ |
|
|
|
|
| sed -n -r -e 's|Serial number.*: ([0-9]*)|\1|p' | tr -d '\n')" |
|
|
|
|
if [ -n "${smartcardSerialNumber}" ]; then |
|
|
|
|
inputPrompt="PIN (OpenPGP card ${smartcardSerialNumber})" |
|
|
|
|