fix: add SSH_AUTH_SOCK to systemd import-environment

Move the systemctl import-environment call after keyring setup so the
SSH_AUTH_SOCK variable exists before being imported into the user
service manager. Remove the earlier duplicate import block.
This commit is contained in:
DeiAsPie 2026-01-06 06:26:44 +05:30 committed by GitHub
parent 1dee7d1a94
commit ec64522110
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,11 +38,6 @@ export QT_AUTO_SCREEN_SCALE_FACTOR=1
export QT_ENABLE_HIGHDPI_SCALING=1
export DCONF_PROFILE=cosmic
if command -v systemctl >/dev/null; then
# set environment variables for new units started by user service manager
systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP DCONF_PROFILE
fi
# Start gnome keyring components if the daemon is active
# -> check if /run/user/$UID/keyring exists
if [ -d "/run/user/$(id -u)/keyring" ]; then
@ -58,6 +53,11 @@ if [ -d "/run/user/$(id -u)/keyring" ]; then
export SSH_AUTH_SOCK="/run/user/$(id -u)/keyring/ssh"
fi
if command -v systemctl >/dev/null; then
# set environment variables for new units started by user service manager
systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP DCONF_PROFILE SSH_AUTH_SOCK
fi
# Run cosmic-session
if [[ -z "${DBUS_SESSION_BUS_ADDRESS}" ]]; then
exec /usr/bin/dbus-run-session -- /usr/bin/cosmic-session