From 9ebd34c528579975ff61ac61723d6d58bdb8a5ee Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 3 Feb 2018 16:31:47 +0800 Subject: zsh/gpg: check the existence of pinentry-program then set it --- _zsh/80-gpg.zsh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to '_zsh') diff --git a/_zsh/80-gpg.zsh b/_zsh/80-gpg.zsh index be1b422..e841d67 100644 --- a/_zsh/80-gpg.zsh +++ b/_zsh/80-gpg.zsh @@ -17,9 +17,12 @@ 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 + local pinentry_arg + [ -x "${HOME}/bin/pinentry" ] && \ + pinentry_arg="--pinentry-program ${HOME}/bin/pinentry" || \ + pinentry_arg="" + gpgconf --kill gpg-agent >/dev/null + gpg-agent --daemon --enable-ssh-support ${pinentry_arg} >/dev/null } # Let pinentry know which console to display in for `ssh-agent'. -- cgit v1.2.2