From e02cc4654d04b7efd5232c23c26a96aff2997b0c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 21 Jun 2015 11:28:53 +0200 Subject: zsh: Use gpg-agent instead of envoy --- tag-zsh/config/zsh/zshenv | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tag-zsh') diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv index c23be400..95377c1a 100755 --- a/tag-zsh/config/zsh/zshenv +++ b/tag-zsh/config/zsh/zshenv @@ -66,8 +66,14 @@ then eval "$(direnv hook zsh)" fi -if [[ $os == gnu && ! -S $SSH_AUTH_SOCK && -s $commands[envoy] ]] +if [[ -s $commands[gpg-agent ]]] then - envoy -t gpg-agent - eval $(envoy -p) + 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 fi -- cgit 1.4.1