fix: resolve conflicts between modules and improve reliability

- Remove duplicate SSH_AUTH_SOCK configuration in apps.sh (now handled by gcr-ssh-agent)
- Remove duplicate system update in apps.sh (now only in install_all)
- Remove duplicate packages from zsh-config (git, zoxide, fastfetch, yt-dlp)
- Add mg_dotfiles verification warning for Zsh/Hyprland modules
- Make .zshrc backup non-critical to avoid interruption
- Improve service verification with status checks before enabling
- Add clarifying comments about cursor configuration layers
This commit is contained in:
Marco Gallegos
2026-01-11 11:49:57 -06:00
parent a2694c7ba6
commit bc44a0bed6
4 changed files with 58 additions and 49 deletions

View File

@@ -197,11 +197,6 @@ run_module_main() {
)
# --- Instalación de Paquetes ---
log_info "Actualizando el sistema para evitar conflictos de dependencias..."
sudo pacman -Syu --noconfirm || {
log_warning "No se pudo completar la actualización del sistema. Pueden ocurrir errores de dependencias."
}
log_info "Instalando herramientas base..."
sudo pacman -S --noconfirm --needed "${PACMAN_BASE[@]}" || {
log_error "Error al instalar herramientas base"
@@ -300,49 +295,43 @@ run_module_main() {
# --- Configuración de Servicios ---
log_info "Configurando servicios del sistema..."
# Configura GNOME Keyring para que actúe como agente de credenciales y SSH.
# Configura GNOME Keyring para que actúe como agente de credenciales.
log_info "Configurando GNOME Keyring como agente de credenciales..."
mkdir -p "${HOME}/.config/environment.d"
cat <<'EOF' > "${HOME}/.config/environment.d/10-gnome-keyring.conf"
SSH_AUTH_SOCK=/run/user/$UID/keyring/ssh
EOF
# Habilita el servicio de GNOME Keyring para el usuario actual.
if systemctl --user enable --now gnome-keyring-daemon.socket gnome-keyring-daemon.service >/dev/null 2>&1; then
log_success "GNOME Keyring listo para gestionar contraseñas y claves SSH."
if systemctl --user enable --now gnome-keyring-daemon.socket >/dev/null 2>&1; then
log_success "GNOME Keyring listo para gestionar contraseñas."
else
log_warning "No se pudo habilitar gnome-keyring-daemon en systemd de usuario. Verifica que tu sesión use systemd (--user)."
fi
# Inicia el daemon de GNOME Keyring en la sesión actual para que `ssh-add` funcione.
if command_exists gnome-keyring-daemon; then
local keyring_eval
keyring_eval="$(gnome-keyring-daemon --start --components=secrets,ssh 2>/dev/null)" || keyring_eval=""
if [[ -n "$keyring_eval" ]]; then
eval "$keyring_eval"
fi
fi
local keyring_socket="/run/user/$UID/keyring/ssh"
if [[ -S "$keyring_socket" ]]; then
export SSH_AUTH_SOCK="$keyring_socket"
fi
log_info "Vuelve a iniciar sesión para que las variables de entorno del keyring se apliquen."
log_info "La sincronización de claves SSH se realizará por separado con el módulo 'K' después de reiniciar la sesión."
log_info "Las claves SSH se gestionarán con el módulo 'K' (gcr-ssh-agent)."
# Habilita los servicios de las aplicaciones instaladas.
if command_exists keyd; then
log_info "Habilitando servicio keyd..."
sudo systemctl enable --now keyd.service 2>/dev/null || true
if systemctl is-enabled keyd.service &>/dev/null; then
log_info "keyd.service ya está habilitado."
else
sudo systemctl enable --now keyd.service 2>/dev/null || true
log_success "keyd.service habilitado."
fi
fi
if command_exists logiops; then
log_info "Habilitando servicio logiops..."
sudo systemctl enable --now logiops.service 2>/dev/null || true
if systemctl is-enabled logiops.service &>/dev/null; then
log_info "logiops.service ya está habilitado."
else
sudo systemctl enable --now logiops.service 2>/dev/null || true
log_success "logiops.service habilitado."
fi
fi
if command_exists teamviewer; then
log_info "Habilitando servicio TeamViewer..."
sudo systemctl enable --now teamviewerd.service 2>/dev/null || true
if systemctl is-enabled teamviewerd.service &>/dev/null; then
log_info "teamviewerd.service ya está habilitado."
else
sudo systemctl enable --now teamviewerd.service 2>/dev/null || true
log_success "teamviewerd.service habilitado."
fi
if sudo teamviewer --daemon start >/dev/null 2>&1; then
log_success "TeamViewer daemon iniciado"
else
@@ -352,10 +341,16 @@ EOF
fi
if command_exists tlp; then
log_info "Habilitando servicio TLP para gestión de energía..."
sudo systemctl enable tlp.service 2>/dev/null || true
sudo systemctl start tlp.service 2>/dev/null || true
log_success "TLP habilitado e iniciado."
if systemctl is-enabled tlp.service &>/dev/null; then
log_info "tlp.service ya está habilitado."
else
sudo systemctl enable tlp.service 2>/dev/null || true
log_success "tlp.service habilitado."
fi
if ! systemctl is-active tlp.service &>/dev/null; then
sudo systemctl start tlp.service 2>/dev/null || true
log_success "tlp.service iniciado."
fi
fi
log_success "Aplicaciones instaladas correctamente"

View File

@@ -45,6 +45,8 @@ install_mouse_cursor() {
fi
# --- Paso 3: Configurar variables de entorno para Hyprland ---
# Nota: Esto configura el cursor para aplicaciones X11 y Hyprland.
# Para aplicaciones GTK/Flatpak, se usa gsettings en el Paso 4.
if [ -f "$ENVS_FILE" ]; then
log_info "Configurando variables de entorno en $ENVS_FILE..."
if ! grep -q "HYPRCURSOR_THEME,${CURSOR_THEME}" "$ENVS_FILE"; then

View File

@@ -41,14 +41,10 @@ install_zsh() {
# --- 1. Instalar paquetes necesarios desde Pacman ---
log_info "Instalando Zsh y herramientas esenciales..."
local pkgs=(
git
zsh
zsh-completions
zsh-syntax-highlighting
zsh-autosuggestions
zoxide # Navegación inteligente
fastfetch # Información del sistema
yt-dlp # Descarga de videos/audio
unrar p7zip lsof # Dependencias para funciones en .zshrc
)
for pkg in "${pkgs[@]}"; do
@@ -156,7 +152,9 @@ install_zsh() {
fi
# Crear copia de seguridad antes de proceder
backup_file "${target_home}/.zshrc" || return 1
if ! backup_file "${target_home}/.zshrc"; then
log_warning "No se pudo crear backup de .zshrc. Sobrescribiendo de todas formas."
fi
log_success "Enlazando .zshrc desde mg_dotfiles..."
ln -sf "$repo_zshrc_path" "${target_home}/.zshrc"
@@ -237,9 +235,9 @@ if [ -t 1 ]; then
fi'
if [[ -f "${target_home}/.bashrc" ]] && ! grep -q "exec zsh" "${target_home}/.bashrc"; then
log_info "Configurando .bashrc para iniciar Zsh automáticamente..."
echo "$bashrc_zsh_loader" >> "${target_home}/.bashrc"
echo -e "\n# Launch Zsh (added by omarchy-setup)\n$bashrc_zsh_loader" >> "${target_home}/.bashrc"
else
log_info ".bashrc ya está configurado para lanzar Zsh."
log_info ".bashrc ya está configurado para lanzar Zsh o no existe."
fi
# --- 7. Mensaje final ---

View File

@@ -25,6 +25,14 @@ if [[ ! -d "${MODULES_DIR}" ]] || [[ ! -f "${MODULES_DIR}/common.sh" ]]; then
exit 1
fi
# Verificar mg_dotfiles si se va a usar Zsh o Hyprland
if [[ ! -d "${DOTFILES_DIR:-}" ]]; then
echo -e "\033[0;33m⚠ Advertencia: mg_dotfiles no encontrado en ${DOTFILES_DIR}\033[0m"
echo "Opciones 2 (Zsh) y H (Hyprland) requieren mg_dotfiles."
echo "Ejecuta: git clone https://github.com/marcogll/mg_dotfiles.git ${DOTFILES_DIR}"
echo ""
fi
# Cargar funciones comunes
source "${MODULES_DIR}/common.sh"
@@ -284,6 +292,12 @@ install_all() {
local failed=()
# Actualizar el sistema antes de instalar todo
log_info "Actualizando el sistema antes de la instalación..."
if ! update_system; then
log_warning "La actualización del sistema falló. Continuando con la instalación..."
fi
for choice in "${INSTALL_ALL_CHOICES[@]}"; do
IFS=';' read -r module_file _ description type <<< "${MODULES[$choice]}"