Skip to content

Commit a97b280

Browse files
committed
Prevent agent hang on alternative gpg homedir
Fix: QubesOS/qubes-issues#9534
1 parent ba13c18 commit a97b280

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

gpg-agent-placeholder

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/bin/bash
2+
set -euo pipefail
23

3-
set -eo pipefail
4-
5-
# prevent starting real gpg-agent locally if it's redirected via split-gpg2
4+
# Prevent starting real gpg-agent locally if it's redirected via split-gpg2,
5+
# which only uses the default GnuPG home directory.
66
if [ -e /run/qubes-service/split-gpg2-client ]; then
7-
exit 0
7+
case "$@" in
8+
*"--homedir $HOME/.gnupg "*)
9+
exit 0
10+
;;
11+
esac
812
fi
9-
# otherwise, launch gpg-agent
10-
gpgagent=$(gpgconf --list-components | grep ^gpg-agent: | cut -d ':' -f 3)
13+
14+
# Otherwise, launch gpg-agent.
15+
gpgagent="$(gpgconf --list-components | awk -F: '/^gpg-agent:/{print $3}')"
1116
exec "$gpgagent" "$@"

0 commit comments

Comments
 (0)