]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(crypt-gpg): cope with different scdaemon location
authorHarald Hoyer <harald@redhat.com>
Wed, 12 May 2021 14:48:52 +0000 (16:48 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 14 May 2021 06:34:27 +0000 (08:34 +0200)
On Arch things are different for some reason.

modules.d/91crypt-gpg/module-setup.sh

index 4d33df1753a9aa1eaeff65d32f07842647036607..634a5149f6444bde3abec80a291c43bc44c2a3fe 100755 (executable)
@@ -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