[IMPROVED] Modificar bootstrap.sh para instalar oathtool y zbar automáticamente

- 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 <noreply@anthropic.com>
This commit is contained in:
Mauro Rosero P. 2025-03-15 19:06:31 -05:00
parent 074643e21d
commit 60d0d3337d
Signed by: mrosero
GPG key ID: 83BD2A5F674B7E26
2 changed files with 21 additions and 52 deletions

View file

@ -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) |

View file

@ -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 ]
@ -189,34 +162,32 @@ install() {
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=""
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 Headers
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