Skip to content

Instantly share code, notes, and snippets.

@Iman
Created December 4, 2012 16:54
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 Iman/bdcdfea02408d445d34a to your computer and use it in GitHub Desktop.
Save Iman/bdcdfea02408d445d34a to your computer and use it in GitHub Desktop.
gpg-agent daemon
#!/bin/bash
#####
#### GPG-AGENT stuff
####GET_TTY=`tty`
####export $GET_TTY
####$HOME/<somercdir>/gpg-agent-start.sh
#####
# Decide wether to start gpg-agent daemon.
# Create necessary symbolic link in $HOME/.gnupg/S.gpg-agent
SOCKET=S.gpg-agent
PIDOF=`pidof gpg-agent`
RETVAL=$?
if [ "$RETVAL" -eq 1 ]; then
echo "Starting gpg-agent daemon."
eval `gpg-agent --daemon `
else
echo "Daemon gpg-agent already running."
fi
# Nasty way to find gpg-agent's socket file...
GPG_SOCKET_FILE=`find /tmp/gpg-* -name $SOCKET`
echo "Updating socket file link."
cp -fs $GPG_SOCKET_FILE $HOME/.gnupg/S.gpg-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment