Created
December 15, 2015 19:24
-
-
Save mrwacky42/45a82675e9ee81405a38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gpgagent=$(type -path gpg-agent) | |
envfile="$HOME/.gnupg/gpg-agent.env" | |
if [ -n "$gpgagent" ]; then | |
agent_pid=$(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) | |
if [[ -e "$envfile" ]] && kill -0 "$agent_pid" 2>/dev/null; then | |
eval "$(cat "$envfile")" | |
else | |
eval "$(gpg-agent --daemon --write-env-file "$envfile")" | |
fi | |
fi | |
unset gpgagent envfile agent_pid | |
export GPG_AGENT_INFO | |
GPG_TTY=$(tty) | |
export GPG_TTY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment