Add gpg convenience script.

This commit is contained in:
Anna Wiggins 2017-03-17 19:16:11 -07:00
parent 63c5cb05bc
commit b6f56ab7af
No known key found for this signature in database
GPG Key ID: 682893DD0448ED78

14
bash/gpg-up.sh Normal file
View File

@ -0,0 +1,14 @@
# This function ensures gpg commands will work properly, in the current shell. I have found it needful on
# OS X when using a smartcard and gpg-agent for ssh auth, in particular.
function gpg-up() {
while [[ $(ps axu | grep gpg-agent | grep -v grep | wc -l | tr -d ' ') -ne '0' ]]; do
pkill gpg-agent
sleep 1
done
gpg-agent --daemon
. ~/.gpg-agent-info
GPG_TTY=$(tty)
export GPG_TTY GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
}