From b7022a415d3697214e9bb385ee1ae23e44191548 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 13 Jan 2018 14:09:18 +0800 Subject: zsh: improve gpg-agent startup and support restart --- _zsh/80-gpg.zsh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '_zsh/80-gpg.zsh') diff --git a/_zsh/80-gpg.zsh b/_zsh/80-gpg.zsh index d72b699..be1b422 100644 --- a/_zsh/80-gpg.zsh +++ b/_zsh/80-gpg.zsh @@ -15,6 +15,13 @@ if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" fi +# Restart `gpg-agent' +restart-gpg-agent() { + gpgconf --kill gpg-agent >/dev/null 2>&1 + gpg-agent --daemon --enable-ssh-support \ + --pinentry-program ${HOME}/bin/pinentry >/dev/null 2>&1 +} + # Let pinentry know which console to display in for `ssh-agent'. # # Since the 'ssh-agent' protocol does not contain a mechanism for telling -- cgit v1.2.2