From e7576fbccb538a3c00059313c3469c8924f57576 Mon Sep 17 00:00:00 2001 From: Marco Gallegos Date: Sat, 1 Mar 2025 17:47:47 -0600 Subject: [PATCH] Update install.sh --- install.sh | 111 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 88 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index f294ad8..79f386a 100644 --- a/install.sh +++ b/install.sh @@ -1,56 +1,121 @@ #!/bin/bash -# 🔧 Script de instalación automatizada para Ubuntu 24.04 +# 🔧 Script de instalación automatizada para Ubuntu 24.04/24.10 # Desarrollado por Ing. Marco Gallegos -# === Función Auxiliar === -command_exists() { - command -v "$1" > /dev/null 2>&1 +# === Definición de Colores ANSI === +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # Sin Color + +# === Variables Globales para Progreso === +TOTAL_STEPS=9 +CURRENT_STEP=0 + +# === Función para Actualizar la Barra de Progreso General === +update_progress() { + local progress=$(( CURRENT_STEP * 100 / TOTAL_STEPS )) + local total=50 + local filled=$(( progress * total / 100 )) + local empty=$(( total - filled )) + # Barra de progreso: [#####-----] 50% + printf "\r${BLUE}Progreso General: [" + for ((i=0; i> /var/log/aura-install.log +} + +# === Función para Incrementar el Contador de Pasos y Actualizar la Barra === +next_step() { + CURRENT_STEP=$(( CURRENT_STEP + 1 )) + update_progress } # === Validaciones Iniciales === -echo "🔍 Verificando versión de Ubuntu..." +echo -e "${BLUE}🔍 Verificando versión de Ubuntu...${NC}" UBUNTU_VERSION=$(lsb_release -rs) -if [[ "$UBUNTU_VERSION" != "24.04" ]]; then - echo "❌ Error: Este script está diseñado para Ubuntu 24.04." +if [[ "$UBUNTU_VERSION" != "24.04" && "$UBUNTU_VERSION" != "24.10" ]]; then + echo -e "${RED}❌ Error: Este script está diseñado para Ubuntu 24.04 o 24.10.${NC}" + log_msg "ERROR" "Versión no compatible: $UBUNTU_VERSION" exit 1 +elif [[ "$UBUNTU_VERSION" == "24.10" ]]; then + echo -e "${YELLOW}⚠️ Advertencia: Ubuntu 24.10 detectado. Continuando la instalación...${NC}" + log_msg "INFO" "Ubuntu 24.10 detectado, se continúa la instalación" fi +next_step -echo "📡 Verificando conectividad a Internet..." +echo -e "${BLUE}📡 Verificando conectividad a Internet...${NC}" if ! ping -c 1 google.com > /dev/null 2>&1; then - echo "❌ Error: No hay conexión a Internet." + echo -e "${RED}❌ Error: No hay conexión a Internet.${NC}" + log_msg "ERROR" "Fallo en la conectividad a Internet" exit 1 fi +next_step # === Configuraciones Previas === -echo "📁 Creando directorio base..." -mkdir -p /home/auraInst/ -echo "📜 Configurando log..." +echo -e "${BLUE}📁 Creando directorio base /home/auraInst/...${NC}" +mkdir -p /home/auraInst/ && log_msg "INFO" "Directorio /home/auraInst/ creado" +next_step + +echo -e "${BLUE}📜 Configurando log en /var/log/aura-install.log...${NC}" +sudo touch /var/log/aura-install.log && sudo chown $USER:$USER /var/log/aura-install.log +# Redirigir salida a log (stdout y stderr) exec > >(tee -a /var/log/aura-install.log) 2>&1 +next_step # === Actualización del Sistema === -echo "🔄 Actualizando el sistema..." +print_step "Actualizando el sistema (apt update & upgrade)" sudo apt update -y && sudo apt upgrade -y +log_msg "INFO" "Sistema actualizado" +next_step # === Instalación de Paquetes Base === -echo "📦 Instalando paquetes esenciales..." -sudo apt install -y git curl wget software-properties-common +print_step "Instalando paquetes esenciales (git, curl, wget, software-properties-common)" +sudo apt install -y git curl wget software-properties-common apt-transport-https ca-certificates lsb-release gnupg +log_msg "INFO" "Paquetes base instalados" +next_step -# === Ejemplo de Personalización === -echo "🧹 Limpiando el escritorio..." +# === Limpieza del Escritorio === +print_step "Limpiando el escritorio y ocultando el icono 'Home'" rm -rf ~/Desktop/* gsettings set org.gnome.nautilus.desktop home-icon-visible false +log_msg "INFO" "Escritorio limpio y home oculto" +next_step -# === Instalación de Aplicaciones Ejemplo === -echo "🌐 Instalando Google Chrome..." +# === Instalación de Google Chrome === +print_step "Instalando Google Chrome" wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb sudo dpkg -i /tmp/chrome.deb sudo apt -f install -y rm /tmp/chrome.deb +log_msg "INFO" "Google Chrome instalado" +next_step -echo "🐚 Instalando Zsh y Oh My Zsh..." +# === Instalación de Zsh y Oh My Zsh === +print_step "Instalando Zsh y configurando Oh My Zsh (modo no interactivo)" sudo apt install -y zsh +# Ejecutar el script de instalación de Oh My Zsh en modo no interactivo sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended +log_msg "INFO" "Zsh y Oh My Zsh instalados" +next_step -# === Finalización === -echo "✅ Instalación completada." -echo "🔧 Desarrollado por Ing. Marco Gallegos" +# === Barra de Progreso Final y Resumen === +update_progress +echo -e "${GREEN}✅ Instalación completada exitosamente.${NC}" +echo -e "${GREEN}🔧 Desarrollado por Ing. Marco Gallegos | Agencia: Aura Dev | Más en: https://github.com/marcogll/ubuntu_aura_install${NC}" +log_msg "INFO" "Instalación finalizada con éxito"