#!/bin/bash # This is the best place to launch gpg-agent. # Note: it should be launched BEFORE dbus. # Why? xfrun4 will not work properly, for example. # Leonid 'darkk' Evdokimov # gpg2 by Michael Weber INFO_FILE="${HOME}/.gnupg/.gpg-agent-info" # default path of thunderbird invoked gpg-agent, I like the path/less files in ~/ gpgagent="`which gpg-agent 2>/dev/null`" if [ -n "$gpgagent" ] && [ -x "$gpgagent" ] && [ -z "$GPG_AGENT_INFO" ] && [ -d "$HOME/.gnupg" ] ; then if [ -r "${INFO_FILE}" ] && kill -0 `cut -d: -f 2 "${INFO_FILE}" 2>/dev/null` 2>/dev/null ; then echo "${gpgagent} already running" else eval `"$gpgagent" --sh --write-env-file ${INFO_FILE} --daemon --default-cache-ttl 300 --max-cache-ttl 999999` fi fi