mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 18:38:00 +00:00
Use $GNUPGHOME in GPG agent startup
Use the value of $GNUPGHOME, to facilitate moving GPG's home. This lets users who keep their GPG keyring on external devices or alternate folders use the gpg-agent autostarting, even if $HOME/.gnupg does not exist.
This commit is contained in:
parent
6fd00449a6
commit
d198c08db5
@ -4,6 +4,7 @@
|
|||||||
# Authors:
|
# Authors:
|
||||||
# Florian Walch <florian.walch@gmx.at>
|
# Florian Walch <florian.walch@gmx.at>
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
# neersighted <neersighted@myopera.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# Return if requirements are not found.
|
# Return if requirements are not found.
|
||||||
@ -11,7 +12,8 @@ if (( ! $+commands[gpg-agent] )); then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_gpg_env="$HOME/.gnupg/gpg-agent.env"
|
# Make sure to use the $GNUPGHOME first.
|
||||||
|
_gpg_env="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.env"
|
||||||
|
|
||||||
function _gpg-agent-start {
|
function _gpg-agent-start {
|
||||||
local ssh_support
|
local ssh_support
|
||||||
@ -20,7 +22,8 @@ function _gpg-agent-start {
|
|||||||
|| ssh_support=''
|
|| ssh_support=''
|
||||||
|
|
||||||
gpg-agent \
|
gpg-agent \
|
||||||
--daemon ${ssh_support:+'--enable-ssh-support'}
|
--daemon \
|
||||||
|
${ssh_support:+'--enable-ssh-support'} \
|
||||||
--write-env-file "${_gpg_env}" > /dev/null
|
--write-env-file "${_gpg_env}" > /dev/null
|
||||||
|
|
||||||
chmod 600 "${_gpg_env}"
|
chmod 600 "${_gpg_env}"
|
||||||
@ -41,4 +44,3 @@ export GPG_AGENT_INFO
|
|||||||
export SSH_AUTH_SOCK
|
export SSH_AUTH_SOCK
|
||||||
export SSH_AGENT_PID
|
export SSH_AGENT_PID
|
||||||
export GPG_TTY="$(tty)"
|
export GPG_TTY="$(tty)"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user