#!/bin/csh # 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" set KEYS="" if (-e "$HOME/.keychain/config") then source "$HOME/.keychain/config" endif foreach i (identity id_rsa id_dsa) if (-e "$HOME/.ssh/$i") then set KEYS="$KEYS $HOME/.ssh/$i" endif end if ((-e "$HOME/.gnupg/gpg.conf") && ($?GPGKEY == 0)) then set GPGKEY=`awk '/^default-key/ {print $2}' "$HOME/.gnupg/gpg.conf"` endif if ($?GPGKEY != 0) then set KEYS="$KEYS $GPGKEY" endif if ($?KEYCHAIN_OPTIONS == 0) then set KEYCHAIN_OPTIONS="" endif if ((-x /usr/bin/keychain) && (-d ~/.keychain)) then keychain -q -Q $KEYCHAIN_OPTIONS $KEYS endif if ($?HOSTNAME == 0) then set HOSTNAME=`/bin/hostname` endif set KEYCHAINFILE=$HOME/.keychain/$HOSTNAME-csh if (-e $KEYCHAINFILE) then source $KEYCHAINFILE endif set KEYCHAINFILEGPG=$HOME/.keychain/$HOSTNAME-csh-gpg if (-e $KEYCHAINFILEGPG) then source $KEYCHAINFILEGPG endif