]> arthur.barton.de Git - ConfigScripts.git/commitdiff
Add support for keychain(1) ssh-agent and gpg-agent helper
authorAlexander Barton <alex@barton.de>
Fri, 18 Apr 2014 13:43:00 +0000 (15:43 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 18 Apr 2014 13:43:00 +0000 (15:43 +0200)
sys/bashrc
user/bash_logout

index 09947a8cd88028ebc45958c8ecb6fbfba80c0f91..911327fde5db176465cdb5f1cc6c925825742fc5 100644 (file)
@@ -9,6 +9,10 @@ BASHRCREAD="true"
 
 [ -z "$PROFILEREAD" -a -r /etc/profile ] && source /etc/profile
 
+# Initialize keychain(1) ssh-agent and gpg-agent helper
+type keychain >/dev/null 2>&1 \
+       && eval `keychain --agents ssh --eval --quick --quiet`
+
 # Interactive shell?
 [ "$PS1" ] || return
 
index b2e4f093297329ef44bafa78ffe2761572cd2ae5..3b258553e95e4e63b6047906d12f15e9c43c2b81 100644 (file)
 
 [ -r ~/.bash_logout.user ] && source ~/.bash_logout.user
 
-# Clean up SSH agents, if running
-[ $SSH_AGENT_PID ] && eval `ssh-agent -k`
+# Clean up SSH agents, if running and not using keychain(1)
+if [ $SSH_AGENT_PID ]; then
+       type keychain >/dev/null 2>&1 || eval `ssh-agent -k`
+fi
 
 # Clear the console if it is a local terminal
 case `tty` in