summary refs log tree commit diff stats
path: root/tag-zsh/config/zsh
diff options
context:
space:
mode:
authorAlan Pearce2015-06-21 11:28:53 +0200
committerAlan Pearce2015-06-21 11:28:53 +0200
commite02cc4654d04b7efd5232c23c26a96aff2997b0c (patch)
tree95cdff3798a5db64c1c0c3d7aa4915c26278c539 /tag-zsh/config/zsh
parentb739f3f4f0a51f0656519a58c52c18909f73e46a (diff)
downloaddotfiles-e02cc4654d04b7efd5232c23c26a96aff2997b0c.tar.lz
dotfiles-e02cc4654d04b7efd5232c23c26a96aff2997b0c.tar.zst
dotfiles-e02cc4654d04b7efd5232c23c26a96aff2997b0c.zip
zsh: Use gpg-agent instead of envoy
Diffstat (limited to 'tag-zsh/config/zsh')
-rwxr-xr-xtag-zsh/config/zsh/zshenv12
1 files changed, 9 insertions, 3 deletions
diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv
index c23be40..95377c1 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