From ee83a406866d4a901cdb5e6093d93ae9f92cf714 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Sun, 31 May 2020 13:41:28 -0700 Subject: [PATCH] Update how we set SSH_AUTH_SOCK. --- dotfiles/zshrc.d/gpg.zsh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dotfiles/zshrc.d/gpg.zsh b/dotfiles/zshrc.d/gpg.zsh index a0ad3e2..cd1d1f4 100644 --- a/dotfiles/zshrc.d/gpg.zsh +++ b/dotfiles/zshrc.d/gpg.zsh @@ -20,13 +20,19 @@ fi # Inform gpg-agent of the current TTY for user prompts. export GPG_TTY="$(tty)" -# Integrate with the SSH module. +# Setup SSH agent support if grep '^enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then # Load required functions. autoload -Uz add-zsh-hook - # Override the ssh-agent environment file default path. - _ssh_agent_env="$_gpg_agent_env" + if test -z "$SSH_AUTH_SOCK" ; then + SSH_AUTH_SOCK="/run/user/$(id -u)/gnupg/S.gpg-agent.ssh" + if test -S "$SSH_AUTH_SOCK" ; then + export SSH_AUTH_SOCK + else + unset SSH_AUTH_SOCK + fi + fi # Updates the GPG-Agent TTY before every command since SSH does not set it. function _gpg-agent-update-tty {