# This sources $HOME/.keychain/$HOSTNAME-sh and # $HOME/.keychain/$HOSTNAME-sh-gpg, to get the ssh-agent and gpg-agent # started by keychain. # Keychain is also started. # By default keychain will only inherit local agents, if you want it to # inherit forwarding agents set $KEYCHAIN_OPTIONS in $HOME/.keychain/config # to something like "--inherit any-once" KEYS="" [ -e "$HOME/.keychain/config" ] && . "$HOME/.keychain/config" for i in identity id_rsa id_dsa;do [ -e "$HOME/.ssh/$i" ] && KEYS="$KEYS $HOME/.ssh/$i" done if [ -e "$HOME/.gnupg/gpg.conf" -a -z "$GPGKEY" ] then GPGKEY=`awk '/^default-key/ {print $2}' "$HOME/.gnupg/gpg.conf"` fi [ -n "$GPGKEY" ] && KEYS="$KEYS $GPGKEY" if [ -x /usr/bin/keychain -a -d ~/.keychain ]; then keychain -q -Q $KEYCHAIN_OPTIONS $KEYS fi KEYCHAINFILE=$HOME/.keychain/$HOSTNAME-sh [ -e $KEYCHAINFILE ] && . $KEYCHAINFILE KEYCHAINFILEGPG=$HOME/.keychain/$HOSTNAME-sh-gpg [ -e $KEYCHAINFILEGPG ] && . $KEYCHAINFILEGPG