From c2c55f492b8fef048429512aaec5c0f324723835 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 25 Aug 2014 20:56:15 +0200 Subject: gpg-agent.sh: better check for running agent Signed-off-by: Florian Pritz --- gpg-agent.sh | 5 +++-- 1 file 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 -- cgit v1.2.3-24-g4f1b