|
|
@ -14,10 +14,10 @@ fi |
|
|
|
_ssh_dir="$HOME/.ssh" |
|
|
|
_ssh_dir="$HOME/.ssh" |
|
|
|
|
|
|
|
|
|
|
|
# Set the path to the environment file if not set by another module. |
|
|
|
# Set the path to the environment file if not set by another module. |
|
|
|
_ssh_agent_env="${_ssh_agent_env:-${TMPDIR:-/tmp}/ssh-agent.env.$UID}" |
|
|
|
_ssh_agent_env="${_ssh_agent_env:-${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.env}" |
|
|
|
|
|
|
|
|
|
|
|
# Set the path to the persistent authentication socket. |
|
|
|
# Set the path to the persistent authentication socket. |
|
|
|
_ssh_agent_sock="${TMPDIR:-/tmp}/ssh-agent.sock.$UID" |
|
|
|
_ssh_agent_sock="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.sock" |
|
|
|
|
|
|
|
|
|
|
|
# Start ssh-agent if not started. |
|
|
|
# Start ssh-agent if not started. |
|
|
|
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then |
|
|
|
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then |
|
|
@ -26,12 +26,14 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then |
|
|
|
|
|
|
|
|
|
|
|
# Start ssh-agent if not started. |
|
|
|
# Start ssh-agent if not started. |
|
|
|
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then |
|
|
|
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then |
|
|
|
|
|
|
|
mkdir -p "$_ssh_agent_env:h" |
|
|
|
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")" |
|
|
|
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")" |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Create a persistent SSH authentication socket. |
|
|
|
# Create a persistent SSH authentication socket. |
|
|
|
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then |
|
|
|
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then |
|
|
|
|
|
|
|
mkdir -p "$_ssh_agent_sock:h" |
|
|
|
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock" |
|
|
|
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock" |
|
|
|
export SSH_AUTH_SOCK="$_ssh_agent_sock" |
|
|
|
export SSH_AUTH_SOCK="$_ssh_agent_sock" |
|
|
|
fi |
|
|
|
fi |
|
|
|