]> git.pld-linux.org Git - packages/gnupg2.git/blame - gnupg-agent.sh
- removed BR: gdbm-devel (seems no longer needed)
[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
11 grep -qE "^pinentry-program.*pinentry-(qt|gtk)" "${HOME}/.gnupg/gpg-agent.conf" && X11=yes
12fi
13
14if grep -q "^use-agent" ${CFG} 2>/dev/null; then
15 if [ -f "${HOME}/.gnupg/GPG_AGENT_INFO" ] && kill -0 "$(cut -d: -f2 $HOME/.gnupg/GPG_AGENT_INFO)" 2>/dev/null; then
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
21 fi
22 fi
23fi
This page took 0.043663 seconds and 4 git commands to generate.