mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-24 04:29:25 +02:00
always source settings of old agent, if applicable
Fixes the problem that the `GPG_AGENT_INFO` environment variable is only exported, if no `gpg-agent` instance is already running.
This commit is contained in:
parent
3c8a33364f
commit
d35846083f
1 changed files with 15 additions and 17 deletions
|
|
@ -14,26 +14,24 @@ function start_agent_withssh {
|
||||||
export SSH_AGENT_PID
|
export SSH_AGENT_PID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# source settings of old agent, if applicable
|
||||||
|
if [ -f "${GPG_ENV}" ]; then
|
||||||
|
. ${GPG_ENV} > /dev/null
|
||||||
|
export GPG_AGENT_INFO
|
||||||
|
export SSH_AUTH_SOCK
|
||||||
|
export SSH_AGENT_PID
|
||||||
|
fi
|
||||||
|
|
||||||
# check if another agent is running
|
# check if another agent is running
|
||||||
if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then
|
if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then
|
||||||
# source settings of old agent, if applicable
|
|
||||||
if [ -f "${GPG_ENV}" ]; then
|
|
||||||
. ${GPG_ENV} > /dev/null
|
|
||||||
export GPG_AGENT_INFO
|
|
||||||
export SSH_AUTH_SOCK
|
|
||||||
export SSH_AGENT_PID
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check again if another agent is running using the newly sourced settings
|
# check for existing ssh-agent
|
||||||
if ! gpg-connect-agent --quiet /bye > /dev/null 2> /dev/null; then
|
if ssh-add -l > /dev/null 2> /dev/null; then
|
||||||
# check for existing ssh-agent
|
# ssh-agent running, start gpg-agent without ssh support
|
||||||
if ssh-add -l > /dev/null 2> /dev/null; then
|
start_agent_nossh;
|
||||||
# ssh-agent running, start gpg-agent without ssh support
|
else
|
||||||
start_agent_nossh;
|
# otherwise start gpg-agent with ssh support
|
||||||
else
|
start_agent_withssh;
|
||||||
# otherwise start gpg-agent with ssh support
|
|
||||||
start_agent_withssh;
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue