aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-01-13 14:09:18 +0800
committerAaron LI <aly@aaronly.me>2018-01-13 14:09:18 +0800
commitb7022a415d3697214e9bb385ee1ae23e44191548 (patch)
tree287c56160eb9fb77eb6a91f5cc126584ef3b16c7
parent1202e25968a5163887c5eb7bb7097d02ebcea449 (diff)
downloaddotfiles-b7022a415d3697214e9bb385ee1ae23e44191548.tar.bz2
zsh: improve gpg-agent startup and support restart
-rw-r--r--_zlogin3
-rw-r--r--_zsh/80-gpg.zsh7
2 files changed, 9 insertions, 1 deletions
diff --git a/_zlogin b/_zlogin
index 65a0364..0d73512 100644
--- a/_zlogin
+++ b/_zlogin
@@ -14,7 +14,8 @@
## Start `gpg-agent' on login (non-SSH connections)
GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent"
if [[ -z ${SSH_CONNECTION} ]] && [[ ! -S "${GPG_AGENT_SOCKET}" ]]; then
- gpgconf --launch gpg-agent
+ gpg-agent --daemon --enable-ssh-support \
+ --pinentry-program ${HOME}/bin/pinentry >/dev/null 2>&1
fi
## Auto start X if login on tty6
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