fix(crypt-gpg): cope with different scdaemon location

On Arch things are different for some reason.
master
Harald Hoyer 2021-05-12 16:48:52 +02:00 committed by Harald Hoyer
parent 5f6be51595
commit 44fd1c1355
1 changed files with 11 additions and 3 deletions

View File

@ -29,7 +29,7 @@ install() {
if sc_requested; then
inst_multiple gpg-agent
inst_multiple gpg-connect-agent
inst_multiple /usr/libexec/scdaemon
inst_multiple -o /usr/libexec/scdaemon /usr/lib/gnupg/scdaemon
cp "$dracutsysrootdir$(sc_public_key)" "${initdir}/root/"
fi
}
@ -42,14 +42,22 @@ sc_public_key() {
sc_supported() {
local gpgMajor
local gpgMinor
local scdaemon
gpgMajor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* ([0-9]*).*|\1|p')"
gpgMinor="$(gpg --version | sed -n 1p | sed -n -r -e 's|.* [0-9]*\.([0-9]*).*|\1|p')"

if [[ -x "$dracutsysrootdir"/usr/libexec/scdaemon ]]; then
scdaemon=/usr/libexec/scdaemon
elif [[ -x "$dracutsysrootdir"/usr/lib/gnupg/scdaemon ]]; then
scdaemon=/usr/lib/gnupg/scdaemon
else
return 1
fi

if [[ ${gpgMajor} -gt 2 || ${gpgMajor} -eq 2 && ${gpgMinor} -ge 1 ]] \
&& require_binaries gpg-agent \
&& require_binaries gpg-connect-agent \
&& require_binaries /usr/libexec/scdaemon \
&& ($DRACUT_LDD "$dracutsysrootdir"/usr/libexec/scdaemon | grep libusb > /dev/null); then
&& ($DRACUT_LDD "${dracutsysrootdir}${scdaemon}" | grep libusb > /dev/null); then
return 0
else
return 1