Compare commits
2 commits
28c95aab40
...
7bb290ef20
Author | SHA1 | Date | |
---|---|---|---|
7bb290ef20 | |||
7e262bb94a |
3 changed files with 119 additions and 12 deletions
|
@ -39,6 +39,8 @@ 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/update.sh` | Actualiza el entorno de desarrollo con las últimas funcionalidades |
|
||||
| `bin/npm_install.sh` | Instala NodeJS y npm de forma interactiva |
|
||||
| `bin/project_new.sh` | Crea un nuevo proyecto con estructura estandarizada según el tipo seleccionado |
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# bootstrap.sh
|
||||
# Modified: 2024/12/01 15:27:00
|
||||
# Derechos de Autor (C) [2024] [Mauro Rosero P. <mauro@roser.one>]
|
||||
# Modified: 2025/03/15 16:30:00
|
||||
# Derechos de Autor (C) [2025] [Mauro Rosero P. <mauro@roser.one>]
|
||||
#
|
||||
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
|
||||
# bajo los términos de la Licencia Pública Affero General de GNU tal como
|
||||
|
@ -48,6 +48,7 @@ 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
|
||||
|
@ -61,9 +62,11 @@ install() {
|
|||
local SQLITE_PACKAGE="$SQLITE_COMMAND libsqlite3-dev"
|
||||
local ANSIBLE_COMMAND=ansible
|
||||
local ANSIBLE_PACKAGE="$ANSIBLE_COMMAND"
|
||||
local OATHTOOL_PACKAGE=oathtool
|
||||
local ZBAR_PACKAGE=zbar
|
||||
|
||||
# Load base bash library
|
||||
BIN_HOME=$BIN_PATH
|
||||
BIN_HOME=$BIN_PATH
|
||||
source $BIN_PATH/$LIBRARY/base.lib
|
||||
|
||||
# Load bootstrap bash library
|
||||
|
@ -72,6 +75,32 @@ 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 ]
|
||||
|
@ -107,12 +136,12 @@ install() {
|
|||
os_pkgs_install $DIALOG_PACKAGE
|
||||
fi
|
||||
|
||||
# Install zip from OS Packages
|
||||
command_installed $ZIP_PACKAGE
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
os_pkgs_install $ZIP_PACKAGE
|
||||
fi
|
||||
# Install zip from OS Packages
|
||||
command_installed $ZIP_PACKAGE
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
os_pkgs_install $ZIP_PACKAGE
|
||||
fi
|
||||
|
||||
# Install sqlite3 from OS Packages
|
||||
command_installed $SQLITE_COMMAND
|
||||
|
@ -165,11 +194,29 @@ install() {
|
|||
# Load messages
|
||||
load_bootstrap_msg $BIN_HOME $BIN_MESG $BIN_LANG
|
||||
|
||||
# Display Headers
|
||||
display_devstools_header "- $bomsg_000"
|
||||
# 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_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"
|
||||
sudo bash -c "$(declare -f load_bootstrap_msg; declare -f install); install $BIN_HOME $BIN_LIBS $BIN_MESG $BIN_LANG '$PACKAGE_TO_INSTALL'"
|
||||
result=$?
|
||||
|
||||
# Run install ansible with regular user
|
||||
|
|
|
@ -358,3 +358,61 @@ function unprivileged_port53() {
|
|||
return $?
|
||||
|
||||
}
|
||||
|
||||
# Install oathtool package
|
||||
function oathtool_install() {
|
||||
echo "Instalando oathtool (herramienta para TOTP/HOTP)..."
|
||||
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
# En macOS, instalamos a través de Homebrew
|
||||
brew install oath-toolkit
|
||||
elif [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then
|
||||
# En sistemas Debian y derivados
|
||||
apt update
|
||||
apt install -y oathtool
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# En sistemas Red Hat
|
||||
dnf install -y oath-toolkit
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
# En Arch Linux
|
||||
pacman -Sy --noconfirm oath-toolkit
|
||||
elif [ -f /etc/rc.conf ]; then
|
||||
# En BSD
|
||||
pkg install -y oath-toolkit
|
||||
else
|
||||
echo "${os_nofound}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "oathtool instalado correctamente."
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install zbar package
|
||||
function zbar_install() {
|
||||
echo "Instalando zbar (herramienta para lectura de códigos QR)..."
|
||||
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
# En macOS, instalamos a través de Homebrew
|
||||
brew install zbar
|
||||
elif [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then
|
||||
# En sistemas Debian y derivados
|
||||
apt update
|
||||
apt install -y zbar-tools
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# En sistemas Red Hat
|
||||
dnf install -y zbar
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
# En Arch Linux
|
||||
pacman -Sy --noconfirm zbar
|
||||
elif [ -f /etc/rc.conf ]; then
|
||||
# En BSD
|
||||
pkg install -y zbar
|
||||
else
|
||||
echo "${os_nofound}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "zbar instalado correctamente."
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue