Skip to content

Instantly share code, notes, and snippets.

@cjbarnes18
Last active August 29, 2015 13:57
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 cjbarnes18/9696773 to your computer and use it in GitHub Desktop.
Save cjbarnes18/9696773 to your computer and use it in GitHub Desktop.
gpg agent persistance
#!/bin/sh
# ...
export SSH_ASKPASS=ssh-askpass
SSH_ENV=$HOME/.ssh/environment
AGENT=gpg-agent
OPTS="--enable-ssh-support --daemon"
RUN="$AGENT $OPTS"
function start_agent {
echo "Initialising new agent..."
/usr/bin/$RUN | sed 's/^echo/#echo/' > ${SSH_ENV}
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
}
if [ -f "${SSH_ENV}" ]; then
. ${SSH_ENV} > /dev/null
pgrep $AGENT | grep ${SSH_AGENT_PID} > /dev/null || {
start_agent;
}
else
start_agent;
fi
/usr/bin/ssh-add &
# ...
if [ "$1" = "debug" ] ; then
urxvt --title "Qtile log" -e python2 /usr/bin/qtile-session
else
python2 /usr/bin/qtile-session -l WARNING
fi
/usr/bin/ssh-add -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment