mirror of
https://github.com/marcogll/scripts_mg.git
synced 2026-01-13 13:25:15 +00:00
Update Omarchy setup script version to 2.8.1
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Omarchy Setup Script v2.8.3 (Omarchy-MG Fusión)
|
# Omarchy Setup Script v2.8.1 (Omarchy-MG Fusión)
|
||||||
# Autor: Marco G. / 2025
|
# Autor: Marco G. / 2025
|
||||||
# Descripción:
|
# Descripción:
|
||||||
# Versión unificada que combina la estética Catppuccin con la robustez
|
# Versión unificada que combina la estética Catppuccin con la robustez
|
||||||
@@ -8,19 +8,21 @@
|
|||||||
# Omite la instalación automática de Nerd Fonts a petición del usuario.
|
# Omite la instalación automática de Nerd Fonts a petición del usuario.
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
|
# Estricto: errores no manejados, variables no definidas y pipes fallidos causan salida
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# COLORES Y CONFIGURACIÓN GLOBAL (Catppuccin Palette)
|
# COLORES Y CONFIGURACIÓN GLOBAL (Catppuccin Latte Palette)
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
FLAMINGO="\e[38;5;245m"
|
# Latte es el tema claro de Catppuccin - colores más brillantes y vibrantes
|
||||||
MAUVE="\e[38;5;140m"
|
FLAMINGO="\e[38;5;174m" # #dd7878 - rosado suave
|
||||||
PEACH="\e[38;5;215m"
|
MAUVE="\e[38;5;135m" # #8839ef - morado vibrante
|
||||||
GREEN="\e[38;5;121m"
|
PEACH="\e[38;5;208m" # #fe640b - naranja/durazno brillante
|
||||||
TEAL="\e[38;5;80m"
|
GREEN="\e[38;5;70m" # #40a02b - verde medio
|
||||||
YELLOW="\e[38;5;229m"
|
TEAL="\e[38;5;37m" # #179299 - teal medio
|
||||||
RED="\e[38;5;203m"
|
YELLOW="\e[38;5;214m" # #df8e1d - amarillo dorado
|
||||||
BLUE="\e[38;5;75m"
|
RED="\e[38;5;196m" # #d20f39 - rojo vibrante
|
||||||
|
BLUE="\e[38;5;27m" # #1e66f5 - azul brillante
|
||||||
RESET="\e[0m"
|
RESET="\e[0m"
|
||||||
|
|
||||||
TOTAL_STEPS=11 # Se redujo el número de pasos
|
TOTAL_STEPS=11 # Se redujo el número de pasos
|
||||||
@@ -38,7 +40,7 @@ setup_logging() {
|
|||||||
exec > >(tee -a "$LOG_FILE")
|
exec > >(tee -a "$LOG_FILE")
|
||||||
exec 2> >(tee -a "$ERROR_LOG" >&2)
|
exec 2> >(tee -a "$ERROR_LOG" >&2)
|
||||||
echo "==================================================================="
|
echo "==================================================================="
|
||||||
echo "OMARCHY SETUP v2.8.3 - $(date '+%Y-%m-%d %H:%M:%S')"
|
echo "OMARCHY SETUP v2.8.1 - MG Setup Script - $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
echo "==================================================================="
|
echo "==================================================================="
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ log_error() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1" >&2; }
|
|||||||
print_header() {
|
print_header() {
|
||||||
clear
|
clear
|
||||||
echo -e "${MAUVE}╔════════════════════════════════════════════════════════════════╗${RESET}"
|
echo -e "${MAUVE}╔════════════════════════════════════════════════════════════════╗${RESET}"
|
||||||
echo -e "${MAUVE}║${RESET} ${PEACH}OMARCHY SETUP v2.8.3 - Edición Fusión${RESET} ${MAUVE}║${RESET}"
|
echo -e "${MAUVE}║${RESET} ${PEACH}OMARCHY SETUP v2.8.1 - MG Setup Script${RESET} ${MAUVE}║${RESET}"
|
||||||
echo -e "${MAUVE}╚════════════════════════════════════════════════════════════════╝${RESET}"
|
echo -e "${MAUVE}╚════════════════════════════════════════════════════════════════╝${RESET}"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${TEAL}Logs:${RESET} $LOG_FILE"
|
echo -e "${TEAL}Logs:${RESET} $LOG_FILE"
|
||||||
@@ -69,11 +71,32 @@ progress_bar() {
|
|||||||
printf "]${RESET} ${percent}%% - ${text}"
|
printf "]${RESET} ${percent}%% - ${text}"
|
||||||
}
|
}
|
||||||
|
|
||||||
step() { CURRENT_STEP=$((CURRENT_STEP + 1)); echo -e "\n${YELLOW}→ [${CURRENT_STEP}/${TOTAL_STEPS}] $1${RESET}"; progress_bar $CURRENT_STEP $TOTAL_STEPS "$1"; sleep 0.3; }
|
step() {
|
||||||
success() { echo -e "\n${GREEN}✓ $1${RESET}"; log "SUCCESS: $1"; }
|
CURRENT_STEP=$((CURRENT_STEP + 1))
|
||||||
warning() { echo -e "\n${PEACH}⚠ $1${RESET}"; log "WARNING: $1"; }
|
echo -e "\n${YELLOW}→ [${CURRENT_STEP}/${TOTAL_STEPS}] $1${RESET}"
|
||||||
error() { echo -e "\n${RED}✗ $1${RESET}"; log_error "$1"; }
|
progress_bar $CURRENT_STEP $TOTAL_STEPS "$1"
|
||||||
info() { echo -e "${TEAL}ℹ $1${RESET}"; log "INFO: $1"; }
|
sleep 0.3
|
||||||
|
}
|
||||||
|
|
||||||
|
success() {
|
||||||
|
echo -e "\n${GREEN}✓ $1${RESET}"
|
||||||
|
log "SUCCESS: $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
warning() {
|
||||||
|
echo -e "\n${PEACH}⚠ $1${RESET}"
|
||||||
|
log "WARNING: $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
echo -e "\n${RED}✗ $1${RESET}"
|
||||||
|
log_error "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
info() {
|
||||||
|
echo -e "${TEAL}ℹ $1${RESET}"
|
||||||
|
log "INFO: $1"
|
||||||
|
}
|
||||||
|
|
||||||
ask_yes_no() {
|
ask_yes_no() {
|
||||||
local prompt="$1"
|
local prompt="$1"
|
||||||
@@ -90,7 +113,9 @@ ask_yes_no() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
check_installed() { pacman -Q "$1" &> /dev/null; }
|
check_installed() {
|
||||||
|
pacman -Q "$1" &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# FUNCIONES PRINCIPALES DE INSTALACIÓN
|
# FUNCIONES PRINCIPALES DE INSTALACIÓN
|
||||||
@@ -105,142 +130,311 @@ check_requirements() {
|
|||||||
|
|
||||||
install_packages() {
|
install_packages() {
|
||||||
step "Instalando paquetes base y utilidades"
|
step "Instalando paquetes base y utilidades"
|
||||||
|
|
||||||
local packages=(
|
local packages=(
|
||||||
git curl wget unzip tar base-devel zsh zsh-completions eza bat zoxide nano
|
git curl wget unzip tar base-devel zsh zsh-completions eza bat zoxide nano
|
||||||
python-pip python-virtualenv nodejs npm go docker docker-compose
|
python-pip python-virtualenv nodejs npm go docker docker-compose
|
||||||
teamviewer audacity inkscape oh-my-posh yt-dlp ffmpeg playerctl
|
teamviewer audacity inkscape yt-dlp ffmpeg playerctl
|
||||||
brightnessctl pamixer lsof net-tools gnome-keyring libsecret seahorse
|
brightnessctl pamixer lsof net-tools gnome-keyring libsecret seahorse
|
||||||
fastfetch htop btop tree p7zip unrar
|
fastfetch htop btop tree p7zip unrar
|
||||||
)
|
)
|
||||||
|
|
||||||
info "Actualizando base de datos de paquetes..."
|
info "Actualizando base de datos de paquetes..."
|
||||||
sudo pacman -Sy --noconfirm
|
sudo pacman -Sy --noconfirm || warning "Error al actualizar base de datos, continuando..."
|
||||||
|
|
||||||
local to_install=()
|
local to_install=()
|
||||||
|
local failed=()
|
||||||
|
|
||||||
|
# Identificar paquetes que faltan
|
||||||
for pkg in "${packages[@]}"; do
|
for pkg in "${packages[@]}"; do
|
||||||
! check_installed "$pkg" && to_install+=("$pkg")
|
if ! check_installed "$pkg"; then
|
||||||
|
to_install+=("$pkg")
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Instalar paquetes faltantes
|
||||||
if [ ${#to_install[@]} -gt 0 ]; then
|
if [ ${#to_install[@]} -gt 0 ]; then
|
||||||
info "Instalando ${#to_install[@]} paquetes nuevos..."
|
info "Instalando ${#to_install[@]} paquetes nuevos..."
|
||||||
sudo pacman -S --noconfirm --needed "${to_install[@]}"
|
# Instalar paquetes de forma individual para mejor manejo de errores
|
||||||
|
for pkg in "${to_install[@]}"; do
|
||||||
|
if sudo pacman -S --noconfirm --needed "$pkg" 2>/dev/null; then
|
||||||
|
info "✓ $pkg instalado correctamente"
|
||||||
|
else
|
||||||
|
warning "✗ No se pudo instalar $pkg, continuando..."
|
||||||
|
failed+=("$pkg")
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#failed[@]} -gt 0 ]; then
|
||||||
|
warning "Los siguientes paquetes no se pudieron instalar: ${failed[*]}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
info "Todos los paquetes base ya están instalados."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar oh-my-posh desde AUR si no está instalado
|
||||||
|
if ! command -v oh-my-posh &>/dev/null; then
|
||||||
|
info "Instalando oh-my-posh desde AUR..."
|
||||||
|
if command -v yay &>/dev/null; then
|
||||||
|
yay -S --noconfirm oh-my-posh-bin 2>/dev/null || warning "No se pudo instalar oh-my-posh desde AUR"
|
||||||
|
else
|
||||||
|
warning "yay no está disponible, oh-my-posh se instalará después de instalar yay"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar speedtest-cli si no está disponible
|
||||||
if ! command -v speedtest &>/dev/null; then
|
if ! command -v speedtest &>/dev/null; then
|
||||||
sudo pip install --break-system-packages speedtest-cli || true
|
info "Instalando speedtest-cli..."
|
||||||
|
sudo pip install --break-system-packages speedtest-cli 2>/dev/null || warning "No se pudo instalar speedtest-cli"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
success "Paquetes base instalados."
|
success "Paquetes base instalados."
|
||||||
}
|
}
|
||||||
|
|
||||||
install_yay() {
|
install_yay() {
|
||||||
step "Instalando 'yay' (AUR helper)"
|
step "Instalando 'yay' (AUR helper)"
|
||||||
if command -v yay &> /dev/null; then success "yay ya está instalado."; return; fi
|
|
||||||
|
# Verificar si yay ya está instalado
|
||||||
|
if command -v yay &> /dev/null; then
|
||||||
|
success "yay ya está instalado."
|
||||||
|
# Intentar instalar oh-my-posh si aún no está instalado
|
||||||
|
if ! command -v oh-my-posh &>/dev/null; then
|
||||||
|
info "Instalando oh-my-posh desde AUR..."
|
||||||
|
yay -S --noconfirm oh-my-posh-bin 2>/dev/null || warning "No se pudo instalar oh-my-posh desde AUR"
|
||||||
|
fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Compilar yay desde AUR
|
||||||
info "Clonando y compilando yay desde AUR..."
|
info "Clonando y compilando yay desde AUR..."
|
||||||
(
|
(
|
||||||
cd /tmp
|
cd /tmp
|
||||||
rm -rf yay
|
rm -rf yay
|
||||||
git clone https://aur.archlinux.org/yay.git --quiet
|
if git clone https://aur.archlinux.org/yay.git --quiet 2>/dev/null; then
|
||||||
cd yay
|
cd yay
|
||||||
makepkg -si --noconfirm --nocheck
|
makepkg -si --noconfirm --nocheck 2>/dev/null || {
|
||||||
)
|
cd /
|
||||||
if command -v yay &> /dev/null; then success "yay instalado correctamente."; else error "Fallo al instalar yay."; exit 1; fi
|
rm -rf /tmp/yay
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
) || {
|
||||||
|
warning "No se pudo instalar yay desde AUR. Continuando sin yay..."
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verificar instalación y instalar oh-my-posh si es necesario
|
||||||
|
if command -v yay &> /dev/null; then
|
||||||
|
success "yay instalado correctamente."
|
||||||
|
# Instalar oh-my-posh después de instalar yay
|
||||||
|
if ! command -v oh-my-posh &>/dev/null; then
|
||||||
|
info "Instalando oh-my-posh desde AUR..."
|
||||||
|
yay -S --noconfirm oh-my-posh-bin 2>/dev/null || warning "No se pudo instalar oh-my-posh desde AUR"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warning "yay no se pudo verificar después de la instalación. Continuando..."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_docker() {
|
setup_docker() {
|
||||||
step "Configurando Docker y permisos de usuario"
|
step "Configurando Docker y permisos de usuario"
|
||||||
sudo systemctl enable --now docker.service
|
if check_installed docker; then
|
||||||
sudo usermod -aG docker "$USER"
|
sudo systemctl enable --now docker.service 2>/dev/null || warning "No se pudo iniciar docker.service"
|
||||||
|
sudo usermod -aG docker "$USER" 2>/dev/null || warning "No se pudo añadir usuario al grupo docker"
|
||||||
success "Docker configurado. Recuerda cerrar y volver a iniciar sesión."
|
success "Docker configurado. Recuerda cerrar y volver a iniciar sesión."
|
||||||
|
else
|
||||||
|
warning "Docker no está instalado, omitiendo configuración."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_ohmyzsh() {
|
install_ohmyzsh() {
|
||||||
step "Instalando Oh My Zsh y plugins"
|
step "Instalando Oh My Zsh y plugins"
|
||||||
if [ -d "$HOME/.oh-my-zsh" ]; then info "Oh My Zsh ya está instalado."; else
|
|
||||||
RUNZSH=no CHSH=no KEEP_ZSHRC=yes sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
# Instalar Oh My Zsh si no está instalado
|
||||||
|
if [ -d "$HOME/.oh-my-zsh" ]; then
|
||||||
|
info "Oh My Zsh ya está instalado."
|
||||||
|
else
|
||||||
|
info "Instalando Oh My Zsh..."
|
||||||
|
if RUNZSH=no CHSH=no KEEP_ZSHRC=yes sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 2>/dev/null; then
|
||||||
|
info "Oh My Zsh instalado correctamente."
|
||||||
|
else
|
||||||
|
warning "No se pudo instalar Oh My Zsh desde el repositorio oficial, continuando..."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configurar directorio de plugins personalizados
|
||||||
local ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
|
local ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
|
||||||
mkdir -p "$ZSH_CUSTOM/plugins"
|
mkdir -p "$ZSH_CUSTOM/plugins" 2>/dev/null || {
|
||||||
git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_CUSTOM/plugins/zsh-autosuggestions" 2>/dev/null || true
|
warning "No se pudo crear directorio de plugins, continuando..."
|
||||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" 2>/dev/null || true
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Instalar plugin de autosugerencias
|
||||||
|
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-autosuggestions" ]; then
|
||||||
|
git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_CUSTOM/plugins/zsh-autosuggestions" 2>/dev/null || warning "No se pudo instalar zsh-autosuggestions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Instalar plugin de resaltado de sintaxis
|
||||||
|
if [ ! -d "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" ]; then
|
||||||
|
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" 2>/dev/null || warning "No se pudo instalar zsh-syntax-highlighting"
|
||||||
|
fi
|
||||||
|
|
||||||
success "Oh My Zsh y plugins listos."
|
success "Oh My Zsh y plugins listos."
|
||||||
}
|
}
|
||||||
|
|
||||||
install_zshrc_and_posh_theme() {
|
install_zshrc_and_posh_theme() {
|
||||||
step "Aplicando configuración .zshrc y tema Catppuccin"
|
step "Aplicando configuración .zshrc y tema Catppuccin"
|
||||||
|
|
||||||
local ZSHRC_URL="https://raw.githubusercontent.com/marcogll/scripts_mg/main/omarchy_zsh_setup/.zshrc"
|
local ZSHRC_URL="https://raw.githubusercontent.com/marcogll/scripts_mg/main/omarchy_zsh_setup/.zshrc"
|
||||||
local DEST="$HOME/.zshrc"
|
local DEST="$HOME/.zshrc"
|
||||||
|
|
||||||
|
# Crear backup del .zshrc existente
|
||||||
if [ -f "$DEST" ]; then
|
if [ -f "$DEST" ]; then
|
||||||
cp "$DEST" "${DEST}.backup.$(date +%Y%m%d_%H%M%S)"
|
if cp "$DEST" "${DEST}.backup.$(date +%Y%m%d_%H%M%S)" 2>/dev/null; then
|
||||||
info "Backup del .zshrc existente creado."
|
info "Backup del .zshrc existente creado."
|
||||||
|
else
|
||||||
|
warning "No se pudo crear backup del .zshrc, continuando..."
|
||||||
fi
|
fi
|
||||||
if curl -fsSL "$ZSHRC_URL" -o "$DEST"; then
|
fi
|
||||||
|
|
||||||
|
# Descargar nuevo .zshrc desde GitHub
|
||||||
|
if curl -fsSL "$ZSHRC_URL" -o "$DEST" 2>/dev/null; then
|
||||||
info "Nuevo .zshrc instalado desde GitHub."
|
info "Nuevo .zshrc instalado desde GitHub."
|
||||||
else
|
else
|
||||||
error "Fallo al descargar .zshrc. Abortando."
|
warning "Fallo al descargar .zshrc desde GitHub. Puedes configurarlo manualmente más tarde."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
mkdir -p ~/.poshthemes
|
|
||||||
wget https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin_frappe.omp.json -O ~/.poshthemes/catppuccin.omp.json -q
|
# Crear directorio para temas de Oh My Posh
|
||||||
|
mkdir -p ~/.poshthemes 2>/dev/null || {
|
||||||
|
warning "No se pudo crear directorio ~/.poshthemes"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Descargar tema Catppuccin Frappe
|
||||||
|
if curl -fsSL https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/catppuccin_frappe.omp.json -o ~/.poshthemes/catppuccin.omp.json 2>/dev/null; then
|
||||||
info "Tema Catppuccin Frappe descargado."
|
info "Tema Catppuccin Frappe descargado."
|
||||||
chsh -s "$(which zsh)" "$USER" || true
|
else
|
||||||
success "Zsh configurado como shell por defecto."
|
warning "No se pudo descargar el tema Catppuccin Frappe, continuando..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configurar zsh como shell por defecto (solo verificación, sin cambiar interactivamente)
|
||||||
|
if command -v zsh &>/dev/null; then
|
||||||
|
local zsh_path=$(which zsh)
|
||||||
|
if [ -n "$zsh_path" ]; then
|
||||||
|
# Verificar si el shell actual ya es zsh
|
||||||
|
current_shell=$(getent passwd "$USER" | cut -d: -f7)
|
||||||
|
if [ "$current_shell" = "$zsh_path" ]; then
|
||||||
|
info "El shell por defecto ya es zsh."
|
||||||
|
else
|
||||||
|
# Asegurarse de que zsh está en /etc/shells
|
||||||
|
if ! grep -Fxq "$zsh_path" /etc/shells 2>/dev/null; then
|
||||||
|
echo "$zsh_path" | sudo tee -a /etc/shells >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
# Informar al usuario sobre cómo cambiar el shell manualmente
|
||||||
|
info "Para cambiar el shell a zsh, ejecuta manualmente: chsh -s $zsh_path"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
success "Zsh listo para usar (cierra y abre la terminal para cambiar al shell)."
|
||||||
|
else
|
||||||
|
warning "zsh no está disponible, omitiendo configuración de shell."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_teamviewer() {
|
setup_teamviewer() {
|
||||||
step "Configurando TeamViewer"
|
step "Configurando TeamViewer"
|
||||||
sudo systemctl enable --now teamviewerd.service
|
if check_installed teamviewer; then
|
||||||
|
sudo systemctl enable --now teamviewerd.service 2>/dev/null || warning "No se pudo iniciar teamviewerd.service"
|
||||||
success "Servicio de TeamViewer habilitado y activo."
|
success "Servicio de TeamViewer habilitado y activo."
|
||||||
NEEDS_REBOOT=true
|
NEEDS_REBOOT=true
|
||||||
|
else
|
||||||
|
warning "TeamViewer no está instalado, omitiendo configuración."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_zerotier() {
|
install_zerotier() {
|
||||||
step "Configurando ZeroTier One"
|
step "Configurando ZeroTier One"
|
||||||
if ! command -v zerotier-cli &> /dev/null; then
|
if ! command -v zerotier-cli &> /dev/null; then
|
||||||
yay -S --noconfirm zerotier-one
|
if command -v yay &>/dev/null; then
|
||||||
|
info "Instalando ZeroTier One desde AUR..."
|
||||||
|
yay -S --noconfirm zerotier-one 2>/dev/null || {
|
||||||
|
warning "No se pudo instalar ZeroTier One desde AUR"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
else
|
||||||
|
warning "yay no está disponible, no se puede instalar ZeroTier One"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
sudo systemctl enable --now zerotier-one.service
|
fi
|
||||||
|
|
||||||
|
if command -v zerotier-cli &>/dev/null; then
|
||||||
|
sudo systemctl enable --now zerotier-one.service 2>/dev/null || warning "No se pudo iniciar zerotier-one.service"
|
||||||
NEEDS_REBOOT=true
|
NEEDS_REBOOT=true
|
||||||
if ask_yes_no "¿Deseas unirte a una red ZeroTier ahora?" "y"; then
|
if ask_yes_no "¿Deseas unirte a una red ZeroTier ahora?" "y"; then
|
||||||
read -p "$(echo -e ${YELLOW}Ingresa el Network ID: ${RESET})" ZEROTIER_NETWORK
|
read -p "$(echo -e ${YELLOW}Ingresa el Network ID: ${RESET})" ZEROTIER_NETWORK
|
||||||
if [ -n "$ZEROTIER_NETWORK" ]; then
|
if [ -n "$ZEROTIER_NETWORK" ]; then
|
||||||
info "Enviando solicitud para unirse a la red..."
|
info "Enviando solicitud para unirse a la red..."
|
||||||
sudo zerotier-cli join "$ZEROTIER_NETWORK"
|
sudo zerotier-cli join "$ZEROTIER_NETWORK" 2>/dev/null || warning "No se pudo unir a la red ZeroTier"
|
||||||
warning "Recuerda autorizar este equipo en my.zerotier.com"
|
warning "Recuerda autorizar este equipo en my.zerotier.com"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
success "ZeroTier configurado."
|
success "ZeroTier configurado."
|
||||||
|
else
|
||||||
|
warning "ZeroTier One no está disponible, omitiendo configuración."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_gnome_keyring() {
|
configure_gnome_keyring() {
|
||||||
step "Configurando GNOME Keyring (almacén de contraseñas)"
|
step "Configurando GNOME Keyring (almacén de contraseñas)"
|
||||||
|
|
||||||
if ask_yes_no "¿Configurar GNOME Keyring para guardar claves de Git/SSH?" "y"; then
|
if ask_yes_no "¿Configurar GNOME Keyring para guardar claves de Git/SSH?" "y"; then
|
||||||
info "Configurando PAM para auto-desbloqueo..."
|
info "Configurando PAM para auto-desbloqueo..."
|
||||||
|
|
||||||
|
# Configurar PAM para auto-desbloqueo del Keyring
|
||||||
if ! grep -q "pam_gnome_keyring" /etc/pam.d/login 2>/dev/null; then
|
if ! grep -q "pam_gnome_keyring" /etc/pam.d/login 2>/dev/null; then
|
||||||
echo "auth optional pam_gnome_keyring.so" | sudo tee -a /etc/pam.d/login > /dev/null
|
echo "auth optional pam_gnome_keyring.so" | sudo tee -a /etc/pam.d/login > /dev/null
|
||||||
echo "session optional pam_gnome_keyring.so auto_start" | sudo tee -a /etc/pam.d/login > /dev/null
|
echo "session optional pam_gnome_keyring.so auto_start" | sudo tee -a /etc/pam.d/login > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Iniciar gnome-keyring-daemon
|
||||||
eval "$(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh 2>/dev/null)"
|
eval "$(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh 2>/dev/null)"
|
||||||
export SSH_AUTH_SOCK
|
export SSH_AUTH_SOCK
|
||||||
|
|
||||||
success "GNOME Keyring configurado."
|
success "GNOME Keyring configurado."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_ssh() {
|
configure_ssh() {
|
||||||
step "Configurando claves SSH con el agente"
|
step "Configurando claves SSH con el agente"
|
||||||
|
|
||||||
if ask_yes_no "¿Buscar y añadir claves SSH existentes al agente?" "y"; then
|
if ask_yes_no "¿Buscar y añadir claves SSH existentes al agente?" "y"; then
|
||||||
|
# Asegurar que el directorio .ssh existe con permisos correctos
|
||||||
mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
||||||
|
|
||||||
|
# Buscar claves SSH válidas
|
||||||
local ssh_keys=()
|
local ssh_keys=()
|
||||||
for key in ~/.ssh/*; do
|
for key in ~/.ssh/*; do
|
||||||
if [ -f "$key" ] && ! [[ "$key" =~ \.pub$|known_hosts|authorized_keys|config|agent ]]; then
|
if [ -f "$key" ] && ! [[ "$key" =~ \.pub$|known_hosts|authorized_keys|config|agent ]]; then
|
||||||
ssh-keygen -l -f "$key" &>/dev/null && ssh_keys+=("$key")
|
ssh-keygen -l -f "$key" &>/dev/null && ssh_keys+=("$key")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Verificar si se encontraron claves
|
||||||
if [ ${#ssh_keys[@]} -eq 0 ]; then
|
if [ ${#ssh_keys[@]} -eq 0 ]; then
|
||||||
warning "No se encontraron claves SSH. Genera una con 'ssh-keygen'."
|
warning "No se encontraron claves SSH. Genera una con 'ssh-keygen'."
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Iniciar gnome-keyring-daemon para SSH
|
||||||
info "Se encontraron ${#ssh_keys[@]} claves. Intentando añadirlas..."
|
info "Se encontraron ${#ssh_keys[@]} claves. Intentando añadirlas..."
|
||||||
eval "$(gnome-keyring-daemon --start --components=ssh 2>/dev/null)"
|
eval "$(gnome-keyring-daemon --start --components=ssh 2>/dev/null)"
|
||||||
export SSH_AUTH_SOCK
|
export SSH_AUTH_SOCK
|
||||||
|
|
||||||
|
# Añadir claves al agente
|
||||||
for key_path in "${ssh_keys[@]}"; do
|
for key_path in "${ssh_keys[@]}"; do
|
||||||
ssh-add "$key_path" < /dev/null && info "Clave '$(basename "$key_path")' añadida."
|
ssh-add "$key_path" < /dev/null && info "Clave '$(basename "$key_path")' añadida."
|
||||||
done
|
done
|
||||||
|
|
||||||
success "Claves SSH añadidas al agente."
|
success "Claves SSH añadidas al agente."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -256,35 +450,47 @@ final_message() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${TEAL}Próximos pasos:${RESET}"
|
echo -e "${TEAL}Próximos pasos:${RESET}"
|
||||||
echo " 1. ${YELLOW}CIERRA Y VUELVE A ABRIR LA TERMINAL${RESET} o reinicia tu sesión para usar Zsh."
|
echo -e " 1. ${YELLOW}CIERRA Y VUELVE A ABRIR LA TERMINAL${RESET} o reinicia tu sesión para usar Zsh."
|
||||||
echo " 2. ${PEACH}NOTA:${RESET} La instalación de fuentes fue omitida. Asegúrate de tener una 'Nerd Font'"
|
echo -e " 2. ${PEACH}NOTA:${RESET} La instalación de fuentes fue omitida. Asegúrate de tener una 'Nerd Font'"
|
||||||
echo " instalada manualmente para que los iconos del prompt se vean correctamente."
|
echo " instalada manualmente para que los iconos del prompt se vean correctamente."
|
||||||
echo " 3. La primera vez que uses una clave SSH, se te pedirá la contraseña para guardarla en el Keyring."
|
echo " 3. La primera vez que uses una clave SSH, se te pedirá la contraseña para guardarla en el Keyring."
|
||||||
echo " 4. Comandos para verificar: 'docker ps', 'teamviewer info', 'speedtest', 'zsh'."
|
echo " 4. Comandos para verificar: ${BLUE}docker ps${RESET}, ${BLUE}teamviewer info${RESET}, ${BLUE}speedtest${RESET}, ${BLUE}zsh${RESET}."
|
||||||
echo -e "\n${MAUVE}🚀 ¡Listo para usar Omarchy con la paleta Catppuccin!${RESET}"
|
echo -e "\n${MAUVE}🚀 ¡Listo para usar Omarchy con la paleta Catppuccin!${RESET}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# EJECUCIÓN PRINCIPAL
|
# EJECUCIÓN PRINCIPAL
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
main() {
|
main() {
|
||||||
|
# Inicializar logging y mostrar cabecera
|
||||||
setup_logging
|
setup_logging
|
||||||
print_header
|
print_header
|
||||||
|
|
||||||
|
# Verificaciones iniciales
|
||||||
check_requirements
|
check_requirements
|
||||||
|
|
||||||
|
# Instalación de paquetes y herramientas base
|
||||||
install_packages
|
install_packages
|
||||||
install_yay
|
install_yay
|
||||||
|
|
||||||
|
# Configuración de servicios base
|
||||||
setup_docker
|
setup_docker
|
||||||
|
|
||||||
|
# Configuración de Zsh y shell
|
||||||
install_ohmyzsh
|
install_ohmyzsh
|
||||||
install_zshrc_and_posh_theme
|
install_zshrc_and_posh_theme
|
||||||
setup_teamviewer
|
|
||||||
|
|
||||||
# Módulos opcionales
|
# Configuración de servicios opcionales
|
||||||
|
setup_teamviewer
|
||||||
install_zerotier
|
install_zerotier
|
||||||
|
|
||||||
|
# Configuración de seguridad y claves
|
||||||
configure_gnome_keyring
|
configure_gnome_keyring
|
||||||
configure_ssh
|
configure_ssh
|
||||||
|
|
||||||
|
# Mensaje final
|
||||||
final_message
|
final_message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ejecutar script principal
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user