#!/bin/sh # Note: it should be launched BEFORE dbus. # Why? xfrun4 will not work properly, for example. # default path of mozilla-thunderbird invoked gpg-agent INFO_FILE="${HOME}/.gnupg/.gpg-agent-info" gpgagent="`which gpg-agent 2>/dev/null`" if [ -n "$gpgagent" ] && [ -x "$gpgagent" ] && [ -z "$GPG_AGENT_INFO" ]; then mkdir -p "${HOME}/.gnupg" if [ $? -eq 0 ]; then if [ -r "${INFO_FILE}" ] && \ kill -0 `cut -d: -f 2 "${INFO_FILE}" 2>/dev/null` 2>/dev/null ; then echo "${gpgagent} already running" # we must export GPG_AGENT_INFO in the environment . "${INFO_FILE}" export GPG_AGENT_INFO else command="$gpgagent --sh --write-env-file ${INFO_FILE} --daemon --default-cache-ttl 300 --max-cache-ttl 999999 -- $command" fi fi fi