Don't clobber ssh-agent

This commit is contained in:
David Tomaschik
2017-11-01 08:54:28 -07:00
parent fdf1ec9790
commit 157ff8a451

View File

@@ -1,4 +1,4 @@
# Custom agent to handle gpg-agent 2.1
# Custom plugin to handle gpg-agent 2.1
local GPG_ENV=$HOME/.gnupg/gpg-agent.env
@@ -18,12 +18,13 @@ function start_agent_withssh {
if [ -z "${GPG_AGENT_INFO}" ] ; then
if which gpgconf >/dev/null 2>&1 ; then
# This might clobber SSH_AUTH_SOCK anyway...
GPG_AGENT_INFO=$(gpgconf --list-dirs agent-socket)
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export GPG_AGENT_INFO
if [ -z "${SSH_AUTH_SOCK}" ] ; then
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export SSH_AUTH_SOCK
fi
fi
fi
# check if another agent is running