moved gpg-agent into config

This commit is contained in:
2022-08-11 20:46:58 +08:00
parent 878e1f5fcb
commit 3574300184
3 changed files with 37 additions and 50 deletions

View File

@@ -0,0 +1,21 @@
#!/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