From 42f93dc9d2553e2a3aa77631e9a05e7a705025ca Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Sun, 29 Oct 2017 20:33:18 -0700 Subject: [PATCH] use gpgconf --- dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh b/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh index 2d51d02..3d77c41 100644 --- a/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/dotfiles/zsh_custom/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -18,9 +18,10 @@ function start_agent_withssh { # check if another agent is running if ! gpg-connect-agent --agent-program /dev/null --quiet /bye > /dev/null 2> /dev/null; then - if [ -d "${XDG_RUNTIME_DIR}/gnupg" ] ; then - GPG_AGENT_INFO=${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent - SSH_AUTH_SOCK=${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh + if which gpgconf ; 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 export SSH_AUTH_SOCK # source settings of old agent, if applicable