From 17f6bb08012c35e53d862444c4c918cc7ffca460 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Tue, 28 Jun 2016 22:54:29 +0200 Subject: [PATCH] Upgrade the way GPG agent is handled. GnuPG 2.1.13 now uses "/run/user/$UID/gnupg/" as the default sockets directory. This commit both update the path and cleans the way it was handled by bash and zsh (why the hell was that done in different ways?). https://lists.gnupg.org/pipermail/gnupg-announce/2016q2/000390.html --- .bashrc | 8 +++----- .zshrc | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.bashrc b/.bashrc index 6ac7a45..dca9acf 100644 --- a/.bashrc +++ b/.bashrc @@ -36,12 +36,10 @@ else fi # GPG Agent -if [ -f "${HOME}/.gpg-agent-info" ]; then - . "${HOME}/.gpg-agent-info" - export GPG_AGENT_INFO - export SSH_AUTH_SOCK -fi export GPG_TTY=$(tty) +export GPG_AGENT_INFO="/run/user/${UID}/gnupg/S.gpg-agent" +export SSH_AUTH_SOCK="/run/user/${UID}/gnupg/S.gpg-agent.ssh" +export SSH_AGENT_PID=$(pgrep -x -u "${USER}" gpg-agent) # Aliases [ -f "$HOME/.aliases" ] && . "$HOME/.aliases" diff --git a/.zshrc b/.zshrc index 3db724a..c48af36 100644 --- a/.zshrc +++ b/.zshrc @@ -41,10 +41,9 @@ fi # GPG Agent export GPG_TTY=$(tty) -unset SSH_AGENT_PID -if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh" -fi +export GPG_AGENT_INFO="/run/user/${UID}/gnupg/S.gpg-agent" +export SSH_AUTH_SOCK="/run/user/${UID}/gnupg/S.gpg-agent.ssh" +export SSH_AGENT_PID=$(pgrep -x -u "${USER}" gpg-agent) # Aliases [ -f "$HOME/.aliases" ] && . "$HOME/.aliases"