1 # On systems with systemd running, we expect the agent to be launched
2 # via systemd's user mode (see /usr/lib/systemd/user/gpg-agent.service
3 # and systemd.unit(5)). This allows systemd to clean up the agent
4 # automatically at logout.
6 # If systemd is absent from your system, or you do not permit it to
7 # run in user mode, then you may need to manually launch gpg-agent
8 # from your session initialization with something like "gpgconf
11 # Nonetheless, ssh and older versions of gpg require environment
12 # variables to be set in order to find the agent, so we will set those
15 agent_sock=$(gpgconf --list-dirs | grep ^agent-socket: | cut -d: -f2)
16 export GPG_AGENT_INFO=${agent_sock}:0:1
17 if [ -n "$(gpgconf --list-options gpg-agent | \
18 awk -F: '/^enable-ssh-support:/{ print $10 }')" ]; then
19 export SSH_AUTH_SOCK=${agent_sock}.ssh