mirror of
https://github.com/marcogll/omarchy_setup.git
synced 2026-01-13 13:25:16 +00:00
fix: improve GNOME Keyring socket detection
This commit fixes a bug in the `ssh-keyring.sh` module where the GNOME Keyring socket could not be found after a system reboot. The script now explicitly determines the user's UID to construct the correct path to the socket, instead of relying on the potentially unreliable `$UID` environment variable. This makes the socket detection more robust, especially when the script is run with `sudo`.
This commit is contained in:
@@ -45,13 +45,19 @@ EOF
|
||||
log_info "GNOME Keyring ya estaba en ejecución."
|
||||
fi
|
||||
|
||||
local keyring_socket="${SSH_AUTH_SOCK:-/run/user/$UID/keyring/ssh}"
|
||||
local target_uid
|
||||
target_uid=$(id -u "${SUDO_USER:-$USER}")
|
||||
local keyring_socket="${SSH_AUTH_SOCK:-/run/user/${target_uid}/keyring/ssh}"
|
||||
|
||||
if [[ ! -S "$keyring_socket" ]]; then
|
||||
log_warning "No se encontró el socket de GNOME Keyring en ${keyring_socket}."
|
||||
if [[ -S "/run/user/$UID/keyring/ssh" ]]; then
|
||||
keyring_socket="/run/user/$UID/keyring/ssh"
|
||||
log_warning "No se encontró el socket de GNOME Keyring en la ruta esperada."
|
||||
# Como fallback, intentamos la ruta con el UID del proceso actual.
|
||||
local fallback_socket="/run/user/$(id -u)/keyring/ssh"
|
||||
if [[ -S "$fallback_socket" ]]; then
|
||||
keyring_socket="$fallback_socket"
|
||||
log_info "Se encontró un socket válido en la ruta de fallback: ${keyring_socket}"
|
||||
else
|
||||
log_error "GNOME Keyring no expone el componente SSH. Revisa tu sesión."
|
||||
log_error "GNOME Keyring no parece estar exponiendo el socket SSH. Asegúrate de haber reiniciado la sesión."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user