summaryrefslogtreecommitdiff
path: root/src/samizdat-gpg-agent
blob: 5b09b7b8b630fb1f9429a6a1696c8f5eec9688d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
export GNUPGHOME=/gpg/gnupghome
do_ps()
{
  . "$GNUPGHOME"/gpg-agent-info
  GPG_PID=${GPG_AGENT_INFO#*:}
  GPG_PID=${GPG_PID%:*}
  /bin/ps uwww $GPG_PID >&2
}

sh_exports()
{
  cat "$GNUPGHOME"/gpg-agent-info || exit
  echo GNUPGHOME="'$GNUPGHOME'"
  echo export GNUPGHOME GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
}

gpg-agent --daemon \
  --enable-ssh-support \
  --allow-preset-passphrase \
  --use-standard-socket \
  --homedir "$GNUPGHOME" \
  --write-env-file "$GNUPGHOME"/gpg-agent-info

case $? in
  0) ;;
  2) [ "$verbose" ] && do_ps ;;
  *) exit $? ;;
esac

sh_exports