From: Maximilian Friedersdorff Date: Mon, 4 Jul 2016 15:01:30 +0000 (+0100) Subject: Change the way gpg agent is called X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;ds=inline;h=6064692c3e68554e4aa791befac2bf8b496e4aee;p=max%2Fdotfiles.git Change the way gpg agent is called --- 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)