Merge pull request #181 from thefossguy/fix-ssh-auth-sock-val

start-cosmic: set SSH_AUTH_SOCK only if the correct value can be determined
This commit is contained in:
Levi Portenier 2026-01-22 09:30:09 -07:00 committed by GitHub
commit 3506cfc404
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,8 +49,14 @@ if [ -d "/run/user/$(id -u)/keyring" ]; then
echo "gnome-keyring-daemon not found in PATH" >&2
fi
# Set SSH_AUTH_SOCK to the standard gnome-keyring socket
export SSH_AUTH_SOCK="/run/user/$(id -u)/keyring/ssh"
# Only set SSH_AUTH_SOCK if the socket actually exists. Either
# set the correct one, or don't set one at all. Don't set the
# wrong value.
if [ -S "/run/user/$(id -u)/gcr/ssh" ]; then
export SSH_AUTH_SOCK="/run/user/$(id -u)/gcr/ssh"
elif [ -S "/run/user/$(id -u)/keyring/ssh" ]; then
export SSH_AUTH_SOCK="/run/user/$(id -u)/keyring/ssh"
fi
fi
if command -v systemctl >/dev/null; then