Skip to content

Commit

Permalink
fix(crypt-gpg): cope with different scdaemon location
Browse files Browse the repository at this point in the history
On Arch things are different for some reason.
  • Loading branch information
haraldh committed May 14, 2021
1 parent 5f6be51 commit 44fd1c1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions modules.d/91crypt-gpg/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down

0 comments on commit 44fd1c1

Please sign in to comment.