]> git.friedersdorff.com Git - max/dotfiles.git/commitdiff
Change the way gpg agent is called
authorMaximilian Friedersdorff <maxf130@gmail.com>
Mon, 4 Jul 2016 15:01:30 +0000 (16:01 +0100)
committerMaximilian Friedersdorff <maxf130@gmail.com>
Mon, 4 Jul 2016 15:01:30 +0000 (16:01 +0100)
bash/.bash_profile
bash/.bashrc

index c4958eba66df8a0efa9538ffa4eadba04ba02ddd..c80cb2dd74ef94227357e06a45e21e74337efec5 100644 (file)
@@ -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"
index 3cf998a6047a9e4ca9da5f73f8a6d34be1679569..9413671004c9a1aa828f881871507dfc42e58853 100644 (file)
@@ -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)