gpg-agent.plugin.zsh 532 B

12345678910111213141516
  1. # Enable gpg-agent if it is not running-
  2. # --use-standard-socket will work from version 2 upwards
  3. AGENT_SOCK=$(gpgconf --list-dirs | grep agent-socket | cut -d : -f 2)
  4. if [[ ! -S $AGENT_SOCK ]]; then
  5. gpg-agent --daemon --use-standard-socket &>/dev/null
  6. fi
  7. export GPG_TTY=$TTY
  8. # Set SSH to use gpg-agent if it's enabled
  9. GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf"
  10. if [[ -r $GNUPGCONFIG ]] && command grep -q enable-ssh-support "$GNUPGCONFIG"; then
  11. export SSH_AUTH_SOCK="$AGENT_SOCK.ssh"
  12. unset SSH_AGENT_PID
  13. fi