Code: Select all
description "GPG Agent"
author "Stéphane Graber <stgraber@ubuntu.com>"
start on starting xsession-init and (no-pinentry-gnome3 or started dbus)
pre-start script
GNUPGHOME=$HOME/.gnupg
[ -d $GNUPGHOME ] || { stop; exit 0; }
# /etc/X11/Xsession.d/90gpg-agent starts the agent without DBUS,
# thus can't use pinentry-gnome3
# but we know we have dbus now, restart gpg-agent
gpgconf --kill gpg-agent
gpgconf --launch gpg-agent
initctl set-env --global GPG_AGENT_INFO=$GNUPGHOME/S.gpg-agent:0:1
if [ -n "$(gpgconf --list-options gpg-agent | awk -F: '/^enable-ssh-support:/{ print $10 }')" ]; then
initctl set-env --global SSH_AUTH_SOCK=$GNUPGHOME/S.gpg-agent.ssh
fi
end script
post-stop script
gpgconf --kill gpg-agent
initctl unset-env --global GPG_AGENT_INFO
if [ -n "$(gpgconf --list-options gpg-agent | awk -F: '/^enable-ssh-support:/{ print $10 }')" ]; then
initctl unset-env --global SSH_AUTH_SOCK
fi
end script
Code: Select all
gpg: selecting openpgp failed: Card not present
gpg: OpenPGP card not available: Card not present
Code: Select all
gpgconf --kill scdaemon && gpgconf --kill gpg-agent && gpgconf --launch gpg-agent
However, my question here would be: Is /usr/share/upstart/sessions/gpg-agent.conf actually being run on boot? If not, does Mint run any of the files in that directly at all? If yes, how do I tell which ones are run by upstart?
I would also welcome any other advice!
P.S. Not sure if it's relevant, but I do remember I had to install dbus-user-session to make gpg-agent communicate with pinentry/seahorse and ask me into enter the passphrase for the key.
P.S. I'm on the last stage of setting up my Yubikey in order to being able use it as a GPG smart card (in addition to U2F and generating OAUTH codes), and apart from that little issue I'm already able to use the gpg keys stored on Yubikey for SSH and commit signing.