fix: preserve configured SSH_AUTH_SOCK

This commit is contained in:
Jim Witte 2026-09-20 21:08:52 -05:00 • committed by Michael Murphy
parent 1e4f10b582
commit 70f9b96ca6

View file

@ -66,14 +66,15 @@ if [ -d "$XDG_RUNTIME_DIR/keyring" ]; then
echo "gnome-keyring-daemon not found in PATH" >&2 echo "gnome-keyring-daemon not found in PATH" >&2
fi fi
# Only set SSH_AUTH_SOCK if the socket actually exists. Either # Preserve an SSH agent configured by the user. Otherwise, use a
# set the correct one, or don't set one at all. Don't set the # Gnome Keyring SSH socket if one exists.
# wrong value. if [ -z "$SSH_AUTH_SOCK" ]; then
if [ -S "$XDG_RUNTIME_DIR/gcr/ssh" ]; then if [ -S "$XDG_RUNTIME_DIR/gcr/ssh" ]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh" export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh"
elif [ -S "$XDG_RUNTIME_DIR/keyring/ssh" ]; then elif [ -S "$XDG_RUNTIME_DIR/keyring/ssh" ]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/keyring/ssh" export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/keyring/ssh"
fi fi
fi
fi fi
if command -v systemctl >/dev/null; then if command -v systemctl >/dev/null; then