]> git.wh0rd.org Git - home.git/commitdiff
do not run keychain when ssh auth forwarding is enabled
authorMike Frysinger <vapier@gentoo.org>
Sun, 15 Jun 2014 01:14:09 +0000 (21:14 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 15 Jun 2014 01:14:09 +0000 (21:14 -0400)
.profile.d/keychain.sh

index 89345492cc49c4fcf0ebdbe9336e4f7aa0695ff4..14a6289858052dfeee897fe159f1ab9ded37fd3b 100644 (file)
@@ -1,5 +1,9 @@
-if type keychain >/dev/null 2>&1 ; then
-       : ${HOSTNAME:=$(hostname)}
-       [ -e ~/.keychain/${HOSTNAME}-sh ] && . ~/.keychain/${HOSTNAME}-sh
-       [ -e ~/.keychain/${HOSTNAME}-sh-gpg ] && . ~/.keychain/${HOSTNAME}-sh-gpg
+# If an auth sock is already set & available, use it.
+# This way ssh agent forwarding still works.
+if [ ! -S "${SSH_AUTH_SOCK}" ] ; then
+       if type keychain >/dev/null 2>&1 ; then
+               : ${HOSTNAME:=$(hostname)}
+               [ -e ~/.keychain/${HOSTNAME}-sh ] && . ~/.keychain/${HOSTNAME}-sh
+               [ -e ~/.keychain/${HOSTNAME}-sh-gpg ] && . ~/.keychain/${HOSTNAME}-sh-gpg
+       fi
 fi