diff options
author | Florian Pritz <bluewind@xssn.at> | 2010-05-06 18:26:16 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xssn.at> | 2010-05-06 18:26:16 +0200 |
commit | 417cf437f6ad5508f675d1f47b95c7eb06dc8dad (patch) | |
tree | 85789cb0a9130b67c04c27e7144c8a1b32bc45f1 /gpg-agent.sh | |
parent | 323c00311d2f90cb7a82286d037ee5fc8c09f960 (diff) | |
download | bin-417cf437f6ad5508f675d1f47b95c7eb06dc8dad.tar.gz bin-417cf437f6ad5508f675d1f47b95c7eb06dc8dad.tar.xz |
gpg-agent.sh: test for socket not PID
Signed-off-by: Florian Pritz <bluewind@xssn.at>
Diffstat (limited to 'gpg-agent.sh')
-rwxr-xr-x | gpg-agent.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gpg-agent.sh b/gpg-agent.sh index ea2871c..8f5cd7d 100755 --- a/gpg-agent.sh +++ b/gpg-agent.sh @@ -1,6 +1,6 @@ #!/bin/bash #---------------------------------------------------- -# Version: 0.1.0 +# Version: 0.2.1 # Author: Florian "Bluewind" Pritz <flo@xssn.at> # # Licensed under WTFPL v2 @@ -11,10 +11,11 @@ # starting multiple agents #---------------------------------------------------- initgpg(){ - [[ -z $XDG_CONFIG_HOME ]] && $XDG_CONFIG_HOME="$HOME/.config" + [[ -z $XDG_CONFIG_HOME ]] && XDG_CONFIG_HOME="$HOME/.config" + [[ -z $XDG_DATA_HOME ]] && XDG_DATA_HOME="$HOME/.local/share" [ -f "$XDG_CONFIG_HOME/disable-gpg-agent" ] && return 0 - envfile="${HOME}/.gpginfo" - if test -f ${envfile} && kill -0 $(cut -d: -f 2 ${envfile} | head -n 1) 2>/dev/null; then + envfile="${XDG_DATA_HOME}/.gpginfo" + if test -f ${envfile} && test -S $(cut -d= -f 2 ${envfile} | head -n 2 | tail -n 1) 2>/dev/null; then eval $(cat ${envfile}) else eval `/usr/bin/gpg-agent --daemon --enable-ssh-support --write-env-file ${envfile}` |