2016-10-08 00:37:22 +00:00
|
|
|
# check for existing running agent info
|
|
|
|
if [[ -e $HOME/.gpg-agent-info ]]; then
|
|
|
|
source $HOME/.gpg-agent-info
|
|
|
|
export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
|
|
|
|
fi
|
|
|
|
|
|
|
|
# test existing agent, remove info file if not working
|
|
|
|
ssh-add -L 2>/dev/null >/dev/null || rm -f $HOME/.gpg-agent-info
|
|
|
|
|
|
|
|
# if no info file, start up potentially-new, working agent
|
|
|
|
if [[ ! -e $HOME/.gpg-agent-info ]]; then
|
2016-10-20 01:39:18 +00:00
|
|
|
if which gpg-agent 2>&1 >/dev/null ; then
|
|
|
|
gpg-agent \
|
|
|
|
--enable-ssh-support \
|
|
|
|
--daemon \
|
|
|
|
--pinentry-program $(brew --prefix)/bin/pinentry-mac \
|
2018-01-22 21:39:45 +00:00
|
|
|
2> /dev/null > $HOME/.gpg-agent-info
|
2016-10-20 01:39:18 +00:00
|
|
|
fi
|
2016-10-08 00:37:22 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# load up new agent info
|
|
|
|
if [[ -e $HOME/.gpg-agent-info ]]; then
|
|
|
|
source $HOME/.gpg-agent-info
|
|
|
|
export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
|
|
|
|
fi
|