]> git.pld-linux.org Git - packages/gnupg2.git/blame - gnupg-agent.sh
- up to 2.0.1, removed obsolete ac patch
[packages/gnupg2.git] / gnupg-agent.sh
CommitLineData
37037e90
AM
1#!/bin/sh
2
3if [ -r "${HOME}/.gnupg/gpg.conf" ]; then
4 CFG="${HOME}/.gnupg/gpg.conf"
5else
6 CFG="${HOME}/.gnupg/options"
7fi
8
9X11=no
10if [ -r "${HOME}/.gnupg/gpg-agent.conf" ]; then
a946dd2a 11 grep -qE "^[[:blank:]]*pinentry-program[[:blank:]]*.*pinentry-(qt|gtk)" "${HOME}/.gnupg/gpg-agent.conf" && X11=yes
37037e90
AM
12fi
13
8753b7ed 14if grep -q "^[[:blank:]]*use-agent" ${CFG} 2>/dev/null; then
2acc22cb 15 if [ -f "${HOME}/.gnupg/GPG_AGENT_INFO" ] && pid="$(cut -d: -f2 $HOME/.gnupg/GPG_AGENT_INFO)" && [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
37037e90
AM
16 export GPG_AGENT_INFO="$(cat ${HOME}/.gnupg/GPG_AGENT_INFO)"
17 else
18 if [ -n "$DISPLAY" -a "$X11" = "yes" ] || [ -z "$DISPLAY" -a "$X11" = "no" ]; then
19 eval "$(gpg-agent --daemon)"
20 echo $GPG_AGENT_INFO > ~/.gnupg/GPG_AGENT_INFO
f6c496b9 21 export GPG_AGENT_INFO
37037e90
AM
22 fi
23 fi
24fi
63d7337b 25unset X11
26unset CFG
27unset pid
This page took 0.168216 seconds and 4 git commands to generate.