From 60d0d3337d40c5aa3097d19b25b2e737cda47426 Mon Sep 17 00:00:00 2001 From: "Mauro Rosero P." Date: Sat, 15 Mar 2025 19:06:31 -0500 Subject: [PATCH] =?UTF-8?q?[IMPROVED]=20Modificar=20bootstrap.sh=20para=20?= =?UTF-8?q?instalar=20oathtool=20y=20zbar=20autom=C3=A1ticamente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Eliminar parámetros específicos para instalaciones individuales - Añadir instalación automática de oathtool y zbar en el flujo principal - Verificar si las herramientas ya están instaladas antes de proceder - Simplificar la función install() y eliminar manejo de parámetros opcionales - Actualizar README para reflejar que bootstrap.sh ahora instala estas herramientas por defecto 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- README.md | 4 +-- bin/bootstrap.sh | 69 ++++++++++++++---------------------------------- 2 files changed, 21 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index e7d5413..b52b961 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,7 @@ bin/update.sh | Comando | Descripción | |---------|-------------| -| `bin/bootstrap.sh` | Instala herramientas básicas y configura la gestión de contenedores | -| `bin/bootstrap.sh --oathtool` | Instala únicamente oathtool (herramienta para TOTP/HOTP) | -| `bin/bootstrap.sh --zbar` | Instala únicamente zbar (herramienta para lectura de códigos QR) | +| `bin/bootstrap.sh` | Instala herramientas básicas (incluyendo oathtool y zbar) y configura la gestión de contenedores | | `bin/update.sh` | Actualiza el entorno de desarrollo con las últimas funcionalidades | | `bin/update.sh --oathtool` | Actualiza únicamente oathtool (herramienta para TOTP/HOTP) | | `bin/update.sh --zbar` | Actualiza únicamente zbar (herramienta para lectura de códigos QR) | diff --git a/bin/bootstrap.sh b/bin/bootstrap.sh index 1ae253a..9dedfaa 100755 --- a/bin/bootstrap.sh +++ b/bin/bootstrap.sh @@ -48,7 +48,6 @@ install() { local LIBRARY=$2 local MESSAGES=$3 local INSTALL_LANG=$4 - local PACKAGE_ONLY=$5 # Paquete específico a instalar (opcional) local PYTHON_PACKAGE=python3 local GIT_PACKAGE=git @@ -75,32 +74,6 @@ install() { # Load bootstrap messages load_bootstrap_msg $BIN_PATH $MESSAGES $INSTALL_LANG - # Si se especificó un paquete específico, instalar solo ese - if [ -n "$PACKAGE_ONLY" ]; then - case "$PACKAGE_ONLY" in - "oathtool") - # Instalar oathtool - command_installed $OATHTOOL_PACKAGE - if [ $? -ne 0 ]; then - oathtool_install - fi - return 0 - ;; - "zbar") - # Instalar zbar - command_installed $ZBAR_PACKAGE - if [ $? -ne 0 ]; then - zbar_install - fi - return 0 - ;; - *) - echo "Paquete '$PACKAGE_ONLY' no reconocido o no soportado." - return 1 - ;; - esac - fi - # Install wget from OS Packages command_installed $WGET_PACKAGE if [ $? -ne 0 ] @@ -188,35 +161,33 @@ install() { then echo "$domsg_005" fi + + # Install oathtool if not already installed + command_installed oathtool + if [ $? -ne 0 ] + then + echo "Instalando oathtool..." + oathtool_install + fi + + # Install zbar if not already installed + command_installed zbar-tools + if [ $? -ne 0 ] + then + echo "Instalando zbar..." + zbar_install + fi } # Load messages load_bootstrap_msg $BIN_HOME $BIN_MESG $BIN_LANG -# Procesar argumentos -PACKAGE_TO_INSTALL="" +# Display Headers +display_devstools_header "- $bomsg_000" -if [ $# -ge 1 ]; then - case "$1" in - "--oathtool") - PACKAGE_TO_INSTALL="oathtool" - display_devstools_header "- Instalación de oathtool" - ;; - "--zbar") - PACKAGE_TO_INSTALL="zbar" - display_devstools_header "- Instalación de zbar" - ;; - *) - display_devstools_header "- $bomsg_000" - ;; - esac -else - display_devstools_header "- $bomsg_000" -fi - -# Run install with sudo -sudo bash -c "$(declare -f load_bootstrap_msg; declare -f install); install $BIN_HOME $BIN_LIBS $BIN_MESG $BIN_LANG '$PACKAGE_TO_INSTALL'" +# Run install with sudo (sin parámetros específicos) +sudo bash -c "$(declare -f load_bootstrap_msg; declare -f install); install $BIN_HOME $BIN_LIBS $BIN_MESG $BIN_LANG" result=$? # Run install ansible with regular user