: ${GNUPGHOME=$HOME/.gnupg}

# always launch the agent, and expose it via the environment to those
# tools that need it:
gpgconf --launch gpg-agent
export GPG_AGENT_INFO=$GNUPGHOME/S.gpg-agent:0:1
if [ -n "$(gpgconf --list-options gpg-agent | \
      awk -F: '/^enable-ssh-support:/{ print $10 }')" ]; then
    export SSH_AUTH_SOCK=$GNUPGHOME/S.gpg-agent.ssh
fi
# the downside to this approach is that the agent gets launched before
# dbus session is initialized, so it doesn't know the native
# parameters for launching pinentry (if it relies on the session dbus).
