Last active
August 29, 2015 13:57
-
-
Save cjbarnes18/9696773 to your computer and use it in GitHub Desktop.
gpg agent persistance
This file contains 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
#!/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