aboutsummaryrefslogtreecommitdiffstats
path: root/_zsh
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-02-03 16:31:47 +0800
committerAaron LI <aly@aaronly.me>2018-02-03 16:31:47 +0800
commit9ebd34c528579975ff61ac61723d6d58bdb8a5ee (patch)
tree2d432e2b9102bde15f7d175119d055e20ca3cecc /_zsh
parent1c2c86aabdb954068bf3be7c0ebf2fe0472223d3 (diff)
downloaddotfiles-9ebd34c528579975ff61ac61723d6d58bdb8a5ee.tar.bz2
zsh/gpg: check the existence of pinentry-program then set it
Diffstat (limited to '_zsh')
-rw-r--r--_zsh/80-gpg.zsh9
1 files changed, 6 insertions, 3 deletions
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'.