aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-21 22:10:08 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-21 22:10:08 +1200
commit1c792276fafe1f1c8a0d7ebbf103fabfc9a1e132 (patch)
tree2a1412d7c7a65e9eb31f413652787cd5836ed595
parent7ddb8084297c5bf30db73e9b9058d71f52991901 (diff)
downloaddotfiles-1c792276fafe1f1c8a0d7ebbf103fabfc9a1e132.tar.gz
dotfiles-1c792276fafe1f1c8a0d7ebbf103fabfc9a1e132.zip
Distill/fix keychain handling a bit
-rw-r--r--sh/profile.d/keychain.sh15
-rw-r--r--sh/shrc.d/keychain.sh5
2 files changed, 8 insertions, 12 deletions
diff --git a/sh/profile.d/keychain.sh b/sh/profile.d/keychain.sh
index 55306ad4..e5d46a41 100644
--- a/sh/profile.d/keychain.sh
+++ b/sh/profile.d/keychain.sh
@@ -1,17 +1,12 @@
# ssh-askpass setup
-if command -v ssh-askpass >/dev/null 2>&1 ; then
- SSH_ASKPASS=$(command -v ssh-askpass)
+[ -n "${SSH_ASKPASS:="$(command -v ssh-askpass 2>&1)"}" ] &&
export SSH_ASKPASS
-fi
# keychain setup
if command -v keychain >/dev/null 2>&1 ; then
- eval "$(TERM=${TERM:-ansi} keychain \
- --eval --ignore-missing --quiet id_dsa id_rsa id_ecsda)"
- # Set and export TTY/GPG_TTY for interactive shells
- if [ -t 0 ] ; then
- GPG_TTY=$(tty)
- export GPG_TTY
- fi
+ # Run keychain as quickly and quietly as possible
+ eval "$(TERM=${TERM:-ansi} keychain \
+ --eval --ignore-missing --quick --quiet \
+ id_dsa id_rsa id_ecsda)"
fi
diff --git a/sh/shrc.d/keychain.sh b/sh/shrc.d/keychain.sh
index 82f83473..e625d704 100644
--- a/sh/shrc.d/keychain.sh
+++ b/sh/shrc.d/keychain.sh
@@ -1,3 +1,4 @@
-# If GPG_TTY is set, update it
-[ -n "$GPG_TTY" ] || return
+# If GPG_AGENT_INFO is set, update GPG_TTY for clean use of pinentry(1) etc
+[ -n "$GPG_AGENT_INFO" ] || return
GPG_TTY=$(tty)
+export GPG_TTY