gpg agent

This commit is contained in:
斟酌 鵬兄 2015-03-10 13:59:33 +08:00
parent dec800c3d0
commit 6cb16f170a

View File

@ -61,6 +61,25 @@ if ! shopt -oq posix; then
fi
fi
if [ -x "/usr/bin/gpg-agent" ]; 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
BASHL_UUID="<UUID>"
export BASH_SDIR=/tmp/$BASHL_UUID
[ ! -d "$BASH_SDIR" ] && mkdir "$BASH_SDIR"