From 78a01f8a446293b8c8fcd8c396e8912d45bf77d7 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Mon, 29 Aug 2022 20:45:07 +0300 Subject: [PATCH] Use gpg-agent setup from the manpage --- home/.config/zsh/01-env.zsh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/home/.config/zsh/01-env.zsh b/home/.config/zsh/01-env.zsh index 1de682b..899359a 100644 --- a/home/.config/zsh/01-env.zsh +++ b/home/.config/zsh/01-env.zsh @@ -58,16 +58,14 @@ export MANPAGER="$EDITOR +\"lua require 'pager'\" +Man!" export SYSTEMD_EDITOR=$EDITOR export SYSTEMD_PAGER=less -if [ "$SSH_CONNECTION" = "" ]; then {%@@ if os == "arch" or os == "ubuntu" @@%} - # set SSH_AUTH_SOCK if not logging in over SSH - export GPG_TTY="$(tty)" - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - gpgconf --launch gpg-agent -{%@@ elif os == "termux" @@%} - eval $(okc-ssh-agent) -{%@@ endif @@%} +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" fi +gpgconf --launch gpg-agent +{%@@ elif os == "termux" @@%} +eval $(okc-ssh-agent) +{%@@ endif @@%} # Enable grc colorization of supported commands [[ -s "/etc/grc.zsh" ]] && source /etc/grc.zsh