]> arthur.barton.de Git - ax-zsh.git/blobdiff - plugins/gnupg/gnupg.zshrc
gnupg: Don't call tty(1), use the $TTY variable
[ax-zsh.git] / plugins / gnupg / gnupg.zshrc
index e1b008ac2652ea105fda59f091bde121e9c69698..2b95624bd8e91d22746826ccc2567f8ab87844eb 100644 (file)
@@ -7,6 +7,16 @@ if (( $+commands[gpg2] )); then
 
        if ! (( $+commands[gpg])); then
                # gpg2 is available, but no gpg: alias it!
-               alias "gpg"="gpg2"
+               alias gpg="gpg2"
        fi
+else
+       # Make sure that "gpg(1)" is available.
+       (( $+commands[gpg] )) || return 1
+fi
+
+export GPG_TTY=$TTY
+
+if (( $+commands[gpg-connect-agent] )); then
+       # Try to start/connect the agent ...
+       ( gpg-connect-agent /bye >/dev/null 2>&1 )
 fi