From 164e33941f8f50b9ead5148905f1bd046a0f352f Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Mon, 30 Oct 2017 01:11:50 +0100 Subject: [PATCH] gnupg: Don't fiddle with gpg-agent that much This isn't necessary with GnuPG 2.1.x and newer. --- plugins/gnupg/README.md | 1 - plugins/gnupg/gnupg.zshrc | 24 +++--------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/plugins/gnupg/README.md b/plugins/gnupg/README.md index 1488335..dfee8df 100644 --- a/plugins/gnupg/README.md +++ b/plugins/gnupg/README.md @@ -6,7 +6,6 @@ starting a new one. - `gpg2`: use the same completions than for `gpg`. - When `gpg` isn't installed but `gpg2` is, alias it to `gpg`, too. -- Store "agent information" in `$HOME/.gnupg/agent.info-$HOST:$DISPLAY`. ### Command Aliases diff --git a/plugins/gnupg/gnupg.zshrc b/plugins/gnupg/gnupg.zshrc index 431b16a..e4be678 100644 --- a/plugins/gnupg/gnupg.zshrc +++ b/plugins/gnupg/gnupg.zshrc @@ -16,25 +16,7 @@ fi export GPG_TTY=$(tty) -agent_info_file="$HOME/.gnupg/agent.info-${HOST}" - -# Validate agent info ... -if [[ -n "$GPG_AGENT_INFO" ]]; then - gpg-agent >/dev/null 2>&1 || unset GPG_AGENT_INFO -fi - -# Read environment file, when available and agent info not already set. -if [[ -z "$GPG_AGENT_INFO" && -r "$agent_info_file" ]]; then - source "$agent_info_file" 2>/dev/null - [[ -n "$GPG_AGENT_INFO" ]] && export GPG_AGENT_INFO +if (( $+commands[gpg-connect-agent] )); then + # Try to start/connect the agent ... + gpg-connect-agent /bye fi - -# Setup GnuPG agent when installed. -if (( $+commands[gpg-agent] )); then - # Start up a new GnuPP agent, when none is running/accessible: - if ! gpg-agent >/dev/null 2>&1; then - eval $(gpg-agent --daemon --write-env-file "$agent_info_file") - fi -fi - -unset agent_info_file -- 2.39.2