From 6064692c3e68554e4aa791befac2bf8b496e4aee Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Mon, 4 Jul 2016 16:01:30 +0100 Subject: [PATCH] Change the way gpg agent is called --- bash/.bash_profile | 12 +++--------- bash/.bashrc | 11 +++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bash/.bash_profile b/bash/.bash_profile index c4958eb..c80cb2d 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -18,13 +18,7 @@ if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi -envfile="$HOME/.gnupg/gpg-agent.env" -if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then - eval "$(cat "$envfile")" -else - eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")" -fi -export GPG_AGENT_INFO # the env file does not contain the export statement -export SSH_AUTH_SOCK # enable gpg-agent for ssh - export TMPDIR="/home/max/.local/tmp" + +gpg-agent --daemon --enable-ssh-support \ + --write-env-file "${HOME}/.gpg-agent-info" diff --git a/bash/.bashrc b/bash/.bashrc index 3cf998a..9413671 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -112,3 +112,14 @@ function __prompt_command() PS1+="\$ " } PROMPT_COMMAND=__prompt_command + + +if [ -f "${HOME}/.gpg-agent-info" ]; then + . "${HOME}/.gpg-agent-info" + export GPG_AGENT_INFO + export SSH_AUTH_SOCK +fi + + +# Set GPG TTY +export GPG_TTY=$(tty) -- 2.45.2