Prevent starting multiple gpg-agents

Don't just overwrite the environment. First check for a running agent (an
x-session might have one running). If no agent is found, source the
environment and check again using those settings. If again no agent is
found, start a new instance.

This closes #1561