# always launch the agent, and expose it via the environment to those
# tools that need it:
gpgconf --launch gpg-agent
agent_sock=$(gpgconf --list-dirs | grep ^agent-socket: | cut -d: -f2)
export GPG_AGENT_INFO=${agent_sock}:0:1
if [ -n "$(gpgconf --list-options gpg-agent | \
      awk -F: '/^enable-ssh-support:/{ print $10 }')" ]; then
    export SSH_AUTH_SOCK=${agent_sock}.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).
