summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-08-25 20:56:15 +0200
committerFlorian Pritz <bluewind@xinu.at>2014-08-25 20:56:15 +0200
commitc2c55f492b8fef048429512aaec5c0f324723835 (patch)
treefcb735fe5bf69199fc515d3114f30ad5f3b56f35
parent3b524772214090829493837e00423635ce29c59c (diff)
downloadbin-c2c55f492b8fef048429512aaec5c0f324723835.tar.gz
bin-c2c55f492b8fef048429512aaec5c0f324723835.tar.xz
gpg-agent.sh: better check for running agent
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xgpg-agent.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/gpg-agent.sh b/gpg-agent.sh
index 801c40b..356af6b 100755
--- a/gpg-agent.sh
+++ b/gpg-agent.sh
@@ -12,8 +12,9 @@
initgpg(){
[[ -z $XDG_CONFIG_HOME ]] && XDG_CONFIG_HOME="$HOME/.config"
[ -f "$XDG_CONFIG_HOME/disable-gpg-agent" ] && return 0
- if [[ ! -S "$HOME/.gnupg/S.gpg-agent.ssh" ]]; then
- pkill gpg-agent
+ #if [[ ! -S "$HOME/.gnupg/S.gpg-agent.ssh" ]]; then
+ if ! pgrep -u ${SUDO_USER:-$USER} -x gpg-agent >/dev/null; then
+ #pkill gpg-agent
/usr/bin/gpg-agent --daemon --enable-ssh-support --use-standard-socket >/dev/null
fi
export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh