Skip to content

Instantly share code, notes, and snippets.

@JorgenEvens
Created April 6, 2016 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JorgenEvens/5f3ea0c1a1048f06b697326425f3bd4b to your computer and use it in GitHub Desktop.
Save JorgenEvens/5f3ea0c1a1048f06b697326425f3bd4b to your computer and use it in GitHub Desktop.
A fallback for gpg-connect-agent on OSX when using Oh-My-Zsh gpg-agent plugin and gnupg from Homebrew.
#!/bin/sh
GPG_ENV=$HOME/.gnupg/gpg-agent.env
if [ ! -f "${GPG_ENV}" ]; then
>&2 echo "GPG_ENV not found"
echo "GPG_ENV not found" >> /tmp/gpg-agent
exit 1
fi
if [ ! -S "${GPG_AGENT_INFO//:*/}" ]; then
>&2 echo "GPG_AGENT_INFO does not point to a socket"
exit 2
fi
pgrep "gpg-agent" > /dev/null
if [ ! $? -eq 0 ]; then
>&2 echo "gpg-agent not running"
exit 3
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment