2018-04-22 04:26:36 +08:00
|
|
|
# Enable gpg-agent if it is not running-
|
|
|
|
# --use-standard-socket will work from version 2 upwards
|
|
|
|
|
|
|
|
AGENT_SOCK=`gpgconf --list-dirs | grep agent-socket | cut -d : -f 2`
|
|
|
|
|
|
|
|
if [ ! -S ${AGENT_SOCK} ]; then
|
|
|
|
gpg-agent --daemon --use-standard-socket >/dev/null 2>&1
|
2017-11-08 00:04:38 +08:00
|
|
|
fi
|
2018-04-22 04:26:36 +08:00
|
|
|
export GPG_TTY=$(tty)
|
2010-10-15 22:50:39 +08:00
|
|
|
|
2018-04-22 04:26:36 +08:00
|
|
|
# Set SSH to use gpg-agent if it's enabled
|
|
|
|
if [ -S "${AGENT_SOCK}.ssh" ]; then
|
|
|
|
export SSH_AUTH_SOCK="${AGENT_SOCK}.ssh"
|
2017-11-08 00:04:38 +08:00
|
|
|
unset SSH_AGENT_PID
|
2013-02-21 09:46:20 +08:00
|
|
|
fi
|
2010-10-15 22:50:39 +08:00
|
|
|
|