mirror of
https://github.com/marcogll/omarchy_setup.git
synced 2026-01-13 13:25:16 +00:00
Add initial log for Omarchy setup script execution with Zsh configuration
- Created a log file capturing the setup process for the Omarchy script. - Included detailed steps for installing Zsh and related tools. - Documented errors encountered during package installations due to database lock. - Logged successful installations and configuration updates for Zsh and Oh My Zsh. - Captured user prompts and actions taken during the setup process.
This commit is contained in:
@@ -36,11 +36,44 @@ log_step() {
|
|||||||
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"
|
echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Función para crear una copia de seguridad de un archivo o directorio
|
||||||
|
# Uso: backup_file "/ruta/al/archivo"
|
||||||
|
backup_file() {
|
||||||
|
local path_to_backup="$1"
|
||||||
|
if [[ -e "$path_to_backup" ]]; then
|
||||||
|
local backup_path="${path_to_backup}.bak_$(date +%F_%T)"
|
||||||
|
log_warning "Se encontró un archivo existente en '${path_to_backup}'."
|
||||||
|
log_info "Creando copia de seguridad en: ${backup_path}"
|
||||||
|
if mv "$path_to_backup" "$backup_path"; then
|
||||||
|
log_success "Copia de seguridad creada."
|
||||||
|
else
|
||||||
|
log_error "No se pudo crear la copia de seguridad. Abortando para evitar pérdida de datos."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# Función para verificar si un comando existe
|
# Función para verificar si un comando existe
|
||||||
command_exists() {
|
command_exists() {
|
||||||
command -v "$1" >/dev/null 2>&1
|
command -v "$1" >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Función para verificar e instalar un paquete con pacman
|
||||||
|
# Uso: check_and_install_pkg "nombre-del-paquete"
|
||||||
|
check_and_install_pkg() {
|
||||||
|
local pkg_name="$1"
|
||||||
|
# pacman -T es una forma de verificar sin instalar, pero no funciona bien con grupos.
|
||||||
|
# pacman -Q es más fiable para paquetes individuales.
|
||||||
|
if ! pacman -Q "$pkg_name" &>/dev/null; then
|
||||||
|
log_info "Instalando ${pkg_name}..."
|
||||||
|
sudo pacman -S --noconfirm --needed "$pkg_name" || log_warning "No se pudo instalar ${pkg_name}."
|
||||||
|
else
|
||||||
|
log_info "${pkg_name} ya está instalado."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Función para instalar helper AUR si no existe
|
# Función para instalar helper AUR si no existe
|
||||||
ensure_aur_helper() {
|
ensure_aur_helper() {
|
||||||
if command_exists yay; then
|
if command_exists yay; then
|
||||||
@@ -75,4 +108,3 @@ cleanup_orphans() {
|
|||||||
sudo pacman -Rns $(pacman -Qtdq) --noconfirm 2>/dev/null || true
|
sudo pacman -Rns $(pacman -Qtdq) --noconfirm 2>/dev/null || true
|
||||||
log_success "Limpieza completada"
|
log_success "Limpieza completada"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ install_docker() {
|
|||||||
log_warning "Necesitarás cerrar sesión y volver a iniciar para usar Docker sin sudo"
|
log_warning "Necesitarás cerrar sesión y volver a iniciar para usar Docker sin sudo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Instalar Portainer
|
echo ""
|
||||||
|
read -p "¿Deseas instalar Portainer (interfaz web para Docker)? [S/n]: " confirm_portainer
|
||||||
|
if [[ ! "${confirm_portainer}" =~ ^[Nn]$ ]]; then
|
||||||
log_info "Configurando Portainer..."
|
log_info "Configurando Portainer..."
|
||||||
|
|
||||||
# Verificar si Portainer ya está corriendo
|
# Verificar si Portainer ya está corriendo
|
||||||
@@ -53,10 +55,13 @@ install_docker() {
|
|||||||
log_info "Accede a Portainer en: https://localhost:9443"
|
log_info "Accede a Portainer en: https://localhost:9443"
|
||||||
else
|
else
|
||||||
log_error "Error al instalar Portainer"
|
log_error "Error al instalar Portainer"
|
||||||
return 1
|
# No retornamos error, Docker ya está instalado.
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_info "Se omitió la instalación de Portainer."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_success "Docker y Portainer configurados correctamente"
|
log_success "Configuración de Docker completada."
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,4 +69,3 @@ install_docker() {
|
|||||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
install_docker "$@"
|
install_docker "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,29 @@ install_zerotier() {
|
|||||||
sudo systemctl enable zerotier-one.service
|
sudo systemctl enable zerotier-one.service
|
||||||
sudo systemctl start zerotier-one.service
|
sudo systemctl start zerotier-one.service
|
||||||
|
|
||||||
log_success "ZeroTier instalado y servicio iniciado"
|
log_success "ZeroTier instalado y servicio iniciado."
|
||||||
log_info "Para unirte a una red, ejecuta: sudo zerotier-cli join <NETWORK_ID>"
|
log_info "Tu ID de ZeroTier es: $(sudo zerotier-cli info | awk '{print $3}')"
|
||||||
log_info "Para ver tu ID de ZeroTier: sudo zerotier-cli info"
|
echo ""
|
||||||
|
|
||||||
|
read -p "¿Deseas unirte a una red de ZeroTier ahora? [s/N]: " confirm
|
||||||
|
if [[ "${confirm}" =~ ^[SsYy]$ ]]; then
|
||||||
|
read -p "Introduce el ID de la red de ZeroTier: " network_id
|
||||||
|
if [[ -n "$network_id" ]]; then
|
||||||
|
log_info "Uniéndote a la red ${network_id}..."
|
||||||
|
if sudo zerotier-cli join "$network_id"; then
|
||||||
|
log_success "Solicitud enviada para unirse a la red ${network_id}."
|
||||||
|
log_warning "Recuerda autorizar este dispositivo en el panel de control de ZeroTier."
|
||||||
|
else
|
||||||
|
log_error "No se pudo unir a la red ${network_id}."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_warning "No se introdujo ningún ID de red. Operación cancelada."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_info "Operación omitida."
|
||||||
|
log_info "Para unirte a una red más tarde, ejecuta:"
|
||||||
|
log_info "sudo zerotier-cli join <NETWORK_ID>"
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -32,4 +52,3 @@ install_zerotier() {
|
|||||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
install_zerotier "$@"
|
install_zerotier "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ install_zsh() {
|
|||||||
|
|
||||||
# --- 3. Descargar y configurar el .zshrc personalizado ---
|
# --- 3. Descargar y configurar el .zshrc personalizado ---
|
||||||
log_info "Descargando configuración .zshrc desde el repositorio..."
|
log_info "Descargando configuración .zshrc desde el repositorio..."
|
||||||
if curl -fsSL "${REPO_BASE}/.zshrc" -o "$HOME/.zshrc.omarchy-tmp"; then
|
# Crear copia de seguridad antes de sobrescribir
|
||||||
|
backup_file "$HOME/.zshrc" || return 1
|
||||||
|
|
||||||
|
if curl -fsSL "${REPO_BASE}/.zshrc" -o "$HOME/.zshrc.omarchy-tmp" && [[ -s "$HOME/.zshrc.omarchy-tmp" ]]; then
|
||||||
mv "$HOME/.zshrc.omarchy-tmp" "$HOME/.zshrc"
|
mv "$HOME/.zshrc.omarchy-tmp" "$HOME/.zshrc"
|
||||||
log_success "Archivo .zshrc actualizado."
|
log_success "Archivo .zshrc actualizado."
|
||||||
else
|
else
|
||||||
|
|||||||
49
omarchy-setup-2025-11-15_12-12-44.log
Normal file
49
omarchy-setup-2025-11-15_12-12-44.log
Normal file
File diff suppressed because one or more lines are too long
122
omarchy-setup-2025-11-15_12-13-46.log
Normal file
122
omarchy-setup-2025-11-15_12-13-46.log
Normal file
File diff suppressed because one or more lines are too long
69
omarchy-setup-2025-11-15_12-14-30.log
Normal file
69
omarchy-setup-2025-11-15_12-14-30.log
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
[H[2J[3J[0;36m╔════════════════════════════════════════════════════════════╗[0m
|
||||||
|
[0;36m║[0m [1m🌀 Omarchy Setup Script — Configuración Modular[0m [0;36m║[0m
|
||||||
|
[0;36m╚════════════════════════════════════════════════════════════╝[0m
|
||||||
|
|
||||||
|
[1mSelecciona las opciones que deseas instalar:[0m
|
||||||
|
|
||||||
|
[0;32m1)[0m 📦 Instalar Aplicaciones (VS Code, VLC, drivers, etc.)
|
||||||
|
[0;32m2)[0m 🐚 Configurar Zsh (shell, plugins, config)
|
||||||
|
[0;32m3)[0m 🐳 Instalar Docker y Portainer
|
||||||
|
[0;32m4)[0m 🌐 Instalar ZeroTier VPN
|
||||||
|
[0;32m5)[0m 🖨️ Configurar Impresoras (CUPS)
|
||||||
|
[0;32m6)[0m 🖱️ Instalar Tema de Cursor (Bibata)
|
||||||
|
[0;32m7)[0m 🎨 Gestionar Temas de Iconos (Papirus, Tela, etc.)
|
||||||
|
[0;32m8)[0m 🎬 Instalar DaVinci Resolve (Intel Edition)
|
||||||
|
[0;32mF)[0m 💾 Formatear un Disco (FAT32, exFAT, NTFS, ext4)
|
||||||
|
[0;32mH)[0m 🎨 Instalar Configuración de Hyprland
|
||||||
|
[0;32mA)[0m ✅ Instalar Todo (opciones 1, 2, 3, 4, 5, 6)
|
||||||
|
[0;32m0)[0m 🚪 Salir
|
||||||
|
|
||||||
|
[0;36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
|
||||||
|
[1mSelecciona opción: [0m[0;36m⠋[0m Ejecutando: Configurar Zsh (shell, plugins, config)...
|
||||||
|
[?25l
|
||||||
|
[0;36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
|
||||||
|
[0;36m[1m Configuración Completa de Zsh[0m
|
||||||
|
[0;36m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
|
||||||
|
|
||||||
|
[0;34m▶[0m [1mInstalando Zsh y herramientas esenciales...[0m
|
||||||
|
[0;34m▶[0m [1mzsh ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1mzsh-completions ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1mzsh-syntax-highlighting ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1mzsh-autosuggestions ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1mInstalando oh-my-posh...[0m
|
||||||
|
error: failed to init transaction (unable to lock database)
|
||||||
|
error: could not lock database: File exists
|
||||||
|
if you're sure a package manager is not already
|
||||||
|
running, you can remove /var/lib/pacman/db.lck
|
||||||
|
[1;33m⚠[0m [1;33mNo se pudo instalar oh-my-posh.[0m
|
||||||
|
[0;34m▶[0m [1mzoxide ya está instalado.[0m
|
||||||
|
[0;36m⠙[0m Ejecutando: Configurar Zsh (shell, plugins, config)...
|
||||||
|
[0;34m▶[0m [1mfastfetch ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1myt-dlp ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1mInstalando nerd-fonts...[0m
|
||||||
|
error: failed to init transaction (unable to lock database)
|
||||||
|
error: could not lock database: File exists
|
||||||
|
if you're sure a package manager is not already
|
||||||
|
running, you can remove /var/lib/pacman/db.lck
|
||||||
|
[1;33m⚠[0m [1;33mNo se pudo instalar nerd-fonts.[0m
|
||||||
|
[0;34m▶[0m [1mInstalando unrar...[0m
|
||||||
|
[0;36m⠹[0m Ejecutando: Configurar Zsh (shell, plugins, config)...
|
||||||
|
error: failed to init transaction (unable to lock database)
|
||||||
|
error: could not lock database: File exists
|
||||||
|
if you're sure a package manager is not already
|
||||||
|
running, you can remove /var/lib/pacman/db.lck
|
||||||
|
[1;33m⚠[0m [1;33mNo se pudo instalar unrar.[0m
|
||||||
|
[0;34m▶[0m [1mInstalando p7zip...[0m
|
||||||
|
error: failed to init transaction (unable to lock database)
|
||||||
|
error: could not lock database: File exists
|
||||||
|
if you're sure a package manager is not already
|
||||||
|
running, you can remove /var/lib/pacman/db.lck
|
||||||
|
[1;33m⚠[0m [1;33mNo se pudo instalar p7zip.[0m
|
||||||
|
[0;34m▶[0m [1mlsof ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1mOh My Zsh ya está instalado.[0m
|
||||||
|
[0;34m▶[0m [1mDescargando configuración .zshrc desde el repositorio...[0m
|
||||||
|
[1;33m⚠[0m [1;33mSe encontró un archivo existente en '/home/marco/.zshrc'.[0m
|
||||||
|
[0;34m▶[0m [1mCreando copia de seguridad en: /home/marco/.zshrc.bak_2025-11-15_12:14:32[0m
|
||||||
|
[0;32m✓[0m [0;32mCopia de seguridad creada.[0m
|
||||||
|
[0;36m⠸[0m Ejecutando: Configurar Zsh (shell, plugins, config)...
|
||||||
|
[0;32m✓[0m [0;32mArchivo .zshrc actualizado.[0m
|
||||||
|
[0;34m▶[0m [1mConfigurando tema de Oh My Posh (Catppuccin Frappe)...[0m
|
||||||
@@ -86,7 +86,7 @@ declare -A MODULES
|
|||||||
MODULES=(
|
MODULES=(
|
||||||
["1"]="apps;run_module_main;📦 Instalar Aplicaciones (VS Code, VLC, drivers, etc.);bg"
|
["1"]="apps;run_module_main;📦 Instalar Aplicaciones (VS Code, VLC, drivers, etc.);bg"
|
||||||
["2"]="zsh-config;install_zsh;🐚 Configurar Zsh (shell, plugins, config);bg"
|
["2"]="zsh-config;install_zsh;🐚 Configurar Zsh (shell, plugins, config);bg"
|
||||||
["3"]="docker;install_docker;🐳 Instalar Docker y Portainer;bg"
|
["3"]="docker;install_docker;🐳 Instalar Docker y Portainer;fg"
|
||||||
["4"]="zerotier;install_zerotier;🌐 Instalar ZeroTier VPN;bg"
|
["4"]="zerotier;install_zerotier;🌐 Instalar ZeroTier VPN;bg"
|
||||||
["5"]="printer;install_printer;🖨️ Configurar Impresoras (CUPS);bg"
|
["5"]="printer;install_printer;🖨️ Configurar Impresoras (CUPS);bg"
|
||||||
["6"]="mouse_cursor;install_mouse_cursor;🖱️ Instalar Tema de Cursor (Bibata);bg"
|
["6"]="mouse_cursor;install_mouse_cursor;🖱️ Instalar Tema de Cursor (Bibata);bg"
|
||||||
@@ -97,7 +97,7 @@ MODULES=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Módulos a incluir en la opción "Instalar Todo"
|
# Módulos a incluir en la opción "Instalar Todo"
|
||||||
INSTALL_ALL_CHOICES=("1" "2" "3" "4" "5" "6")
|
INSTALL_ALL_CHOICES=("1" "2" "3" "4" "5" "6" "8")
|
||||||
|
|
||||||
# Función para mostrar el menú
|
# Función para mostrar el menú
|
||||||
show_menu() {
|
show_menu() {
|
||||||
@@ -161,14 +161,27 @@ install_all() {
|
|||||||
local failed=()
|
local failed=()
|
||||||
|
|
||||||
for choice in "${INSTALL_ALL_CHOICES[@]}"; do
|
for choice in "${INSTALL_ALL_CHOICES[@]}"; do
|
||||||
IFS=';' read -r module_file _ description _ <<< "${MODULES[$choice]}"
|
IFS=';' read -r module_file _ description type <<< "${MODULES[$choice]}"
|
||||||
log_info "Ejecutando: ${description}"
|
|
||||||
|
# Separador visual para cada módulo
|
||||||
|
echo -e "\n${MAGENTA}────────────────────────────────────────────────────────────${NC}"
|
||||||
|
log_step "Iniciando Módulo: ${description}"
|
||||||
|
|
||||||
|
# Ejecutar con spinner para tareas de fondo (bg)
|
||||||
|
if [[ "$type" == "bg" ]]; then
|
||||||
|
start_spinner "Ejecutando: ${description#* }..."
|
||||||
if run_module "${choice}"; then
|
if run_module "${choice}"; then
|
||||||
log_success "Módulo ${module_file} completado"
|
stop_spinner 0 "Módulo '${description}' finalizado."
|
||||||
else
|
else
|
||||||
log_error "Error en el módulo ${module_file}"
|
stop_spinner 1 "Error en el módulo '${description}'."
|
||||||
failed+=("${module_file}")
|
failed+=("${module_file}")
|
||||||
fi
|
fi
|
||||||
|
else # Ejecutar sin spinner para tareas interactivas (fg)
|
||||||
|
if ! run_module "${choice}"; then
|
||||||
|
log_error "Error en el módulo '${description}'."
|
||||||
|
failed+=("${module_file}")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -244,8 +257,11 @@ main() {
|
|||||||
|
|
||||||
elif [[ "$choice" == "A" ]]; then
|
elif [[ "$choice" == "A" ]]; then
|
||||||
echo -ne "${BOLD}¿Instalar todas las opciones (1, 2, 3, 4, 5, 6)? [s/N]: ${NC} "
|
echo -ne "${BOLD}¿Instalar todas las opciones (1, 2, 3, 4, 5, 6)? [s/N]: ${NC} "
|
||||||
|
log_warning "NOTA: La opción 'Instalar Todo' incluye DaVinci Resolve, que requiere"
|
||||||
|
log_warning "que hayas descargado el archivo ZIP manualmente en tu carpeta ~/Downloads/."
|
||||||
|
echo -ne "${BOLD}¿Confirmas que has hecho esto y deseas continuar? [s/N]: ${NC} "
|
||||||
read -r confirm
|
read -r confirm
|
||||||
if [[ "${confirm}" =~ ^[Ss]$ ]]; then
|
if [[ "${confirm}" =~ ^[SsYy]$ ]]; then
|
||||||
install_all
|
install_all
|
||||||
else
|
else
|
||||||
log_info "Instalación cancelada"
|
log_info "Instalación cancelada"
|
||||||
@@ -263,4 +279,11 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Ejecutar función principal
|
# Ejecutar función principal
|
||||||
main "$@"
|
|
||||||
|
# --- Redirección de logs ---
|
||||||
|
# Crear un nombre de archivo de log con la fecha y hora
|
||||||
|
LOG_FILE="${SCRIPT_DIR}/omarchy-setup-$(date +%F_%H-%M-%S).log"
|
||||||
|
|
||||||
|
# Ejecutar la función principal y redirigir toda la salida (stdout y stderr)
|
||||||
|
# al archivo de log, mientras también se muestra en la terminal.
|
||||||
|
main "$@" 2>&1 | tee -a "${LOG_FILE}"
|
||||||
|
|||||||
Reference in New Issue
Block a user