aboutsummaryrefslogtreecommitdiff
path: root/gpg-agent-eval
blob: 76bebe40df8a14781d2d110c9a3209885e136791 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
#
# Initialize the gpg-agent
#

# GPG Agent
GPG_TTY=`tty`
export GPG_TTY

gpg_agent_eval_run() {
  if test -f $HOME/.gpg-agent-info && \
    kill -0 `cut -d: -f 2 $HOME/.gpg-agent-info` 2> /dev/null; then
    GPG_AGENT_INFO=`cat $HOME/.gpg-agent-info`
    export GPG_AGENT_INFO
  else
    eval `gpg-agent --daemon`
    echo $GPG_AGENT_INFO >$HOME/.gpg-agent-info
  fi
}

gpg_agent_eval_run