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
+ && ls /root/crypt-public-key*.gpg > /dev/null 2>&1 && getargbool 1 rd.luks.smartcard; then
useSmartcard="1"
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
+ for file in /root/crypt-public-key*.gpg; do
+ GNUPGHOME="$gpghome" gpg --quiet --no-tty --import < "$file"
+ done
GNUPGHOME="$gpghome" gpg-connect-agent 1> /dev/null learn /bye
local smartcardSerialNumber
smartcardSerialNumber="$(GNUPGHOME=$gpghome gpg --no-tty --card-status \
inst_multiple gpg-agent
inst_multiple gpg-connect-agent
inst_multiple -o /usr/libexec/scdaemon /usr/lib/gnupg/scdaemon
- cp "$dracutsysrootdir$(sc_public_key)" "${initdir}/root/"
+
+ while IFS= read -r -d '' key; do
+ cp "$dracutsysrootdir$key" "${initdir}/root/"
+ done < <(sc_public_key)
fi
}
sc_public_key() {
- echo -n "/etc/dracut.conf.d/crypt-public-key.gpg"
+ find /etc/dracut.conf.d -maxdepth 1 -type f -iname 'crypt-public-key*.gpg' -print0
}
# CCID Smartcard support requires GnuPG >= 2.1 with scdaemon and libusb
}
sc_requested() {
- if [ -f "$dracutsysrootdir$(sc_public_key)" ]; then
- return 0
- else
- return 1
- fi
+ while IFS= read -r -d '' key; do
+ if [ -f "$dracutsysrootdir$key" ]; then
+ return 0
+ fi
+ done < <(sc_public_key)
+ return 1
}