You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
731 B
36 lines
731 B
13 years ago
|
#
|
||
|
# Provides for an easier use of gpg-agent.
|
||
|
#
|
||
|
# Authors:
|
||
|
# Florian Walch <florian.walch@gmx.at>
|
||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||
|
#
|
||
14 years ago
|
|
||
14 years ago
|
if (( ! $+commands[gpg-agent] )); then
|
||
13 years ago
|
return 1
|
||
14 years ago
|
fi
|
||
|
|
||
13 years ago
|
_gpg_env="$HOME/.gnupg/gpg-agent.env"
|
||
|
|
||
13 years ago
|
function _gpg-agent-start {
|
||
13 years ago
|
gpg-agent --daemon --enable-ssh-support --write-env-file "${_gpg_env}" > /dev/null
|
||
13 years ago
|
chmod 600 "${_gpg_env}"
|
||
13 years ago
|
source "${_gpg_env}" > /dev/null
|
||
14 years ago
|
}
|
||
|
|
||
14 years ago
|
# Source GPG agent settings, if applicable.
|
||
13 years ago
|
if [[ -f "${_gpg_env}" ]]; then
|
||
13 years ago
|
source "${_gpg_env}" > /dev/null
|
||
13 years ago
|
ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'gpg-agent' || {
|
||
13 years ago
|
_gpg-agent-start
|
||
14 years ago
|
}
|
||
|
else
|
||
13 years ago
|
_gpg-agent-start
|
||
14 years ago
|
fi
|
||
|
|
||
|
export GPG_AGENT_INFO
|
||
|
export SSH_AUTH_SOCK
|
||
|
export SSH_AGENT_PID
|
||
13 years ago
|
export GPG_TTY="$(tty)"
|
||
14 years ago
|
|