utils/bash/sources/15_gpg-agent

22 lines
443 B
Bash

#!/bin/bash
which gpg-agent 2>&1 > /dev/null
if [ $? -eq 0 ]; then
GPG_ENV="$HOME/.gnupg/environment"
function __start_agent {
gpg-agent --daemon > "${GPG_ENV}"
chmod 600 "${GPG_ENV}"
. "${GPG_ENV}" > /dev/null
}
if [ -f "${GPG_ENV}" ]; then
. "${GPG_ENV}" > /dev/null
gpg-agent > /dev/null 2>&1
[ "$?" -ne 0 ] && { __start_agent; }
else
__start_agent;
fi
fi