Mauro Rosero P.
5313dfbd8a
- bootstrap.sh: se corrige la instalación de ansilbe usando paquete de sistema - vpn_users.sh: se usa la función para el despliegue de titulo de proyecto global devs
166 lines
3.7 KiB
Bash
Executable file
166 lines
3.7 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# bootstrap.sh
|
|
# Modified: 2024/12/01 15:27:00
|
|
# Derechos de Autor (C) [2024] [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
|
|
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
|
|
# o (a su elección) cualquier versión posterior.
|
|
#
|
|
# Este programa se distribuye con la esperanza de que sea útil,
|
|
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
|
|
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
|
|
# Licencia Pública Affero General de GNU para obtener más detalles.
|
|
#
|
|
# Debería haber recibido una copia de la Licencia Pública Affero General
|
|
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
|
|
|
|
DEVSPATH=devs
|
|
BIN_HOME=$HOME/$DEVSPATH
|
|
BIN_MESG=bin/msg
|
|
BIN_LIBS=bin/lib
|
|
|
|
# CHECK SHELL LANGUAGE
|
|
BIN_LANG=${LANG:0:2}
|
|
|
|
# LOAD BASE BASH LIBRARY
|
|
source $BIN_HOME/$BIN_LIBS/base.lib
|
|
#baselib_test
|
|
|
|
load_bootstrap_msg() {
|
|
|
|
local BIN_PATH=$1
|
|
local MSG_PATH=$2
|
|
local LANGUAGE=$3
|
|
|
|
# Load head messages
|
|
load_messages $BIN_PATH $MSG_PATH $LANGUAGE "head"
|
|
|
|
# Load bootstrap messages
|
|
load_messages $BIN_PATH $MSG_PATH $LANGUAGE "bootstrap"
|
|
|
|
}
|
|
|
|
install() {
|
|
local BIN_PATH=$1
|
|
local LIBRARY=$2
|
|
local MESSAGES=$3
|
|
local INSTALL_LANG=$4
|
|
|
|
local PYTHON_PACKAGE=python3
|
|
local GIT_PACKAGE=git
|
|
local CURL_PACKAGE=curl
|
|
local WGET_PACKAGE=wget
|
|
local DIALOG_PACKAGE=dialog
|
|
local SOPS_PACKAGE=sops
|
|
local GNUPG_PACKAGE=gnupg
|
|
local ZIP_PACKAGE=zip
|
|
local SQLITE_COMMAND=sqlite3
|
|
local SQLITE_PACKAGE="$SQLITE_COMMAND libsqlite3-dev"
|
|
local ANSIBLE_COMMAND=ansible
|
|
local ANSIBLE_PACKAGE="$ANSIBLE_COMMAND"
|
|
|
|
# Load base bash library
|
|
source $BIN_PATH/$LIBRARY/base.lib
|
|
|
|
# Load bootstrap bash library
|
|
source $BIN_PATH/$LIBRARY/bootstrap.lib
|
|
|
|
# Load bootstrap messages
|
|
load_bootstrap_msg $BIN_PATH $MESSAGES $INSTALL_LANG
|
|
|
|
# Install wget from OS Packages
|
|
command_installed $WGET_PACKAGE
|
|
if [ $? -ne 0 ]
|
|
then
|
|
os_pkgs_install $WGET_PACKAGE
|
|
fi
|
|
|
|
# Install curl from OS Packages
|
|
command_installed $CURL_PACKAGE
|
|
if [ $? -ne 0 ]
|
|
then
|
|
os_pkgs_install $CURL_PACKAGE
|
|
fi
|
|
|
|
# Install git from OS Packages
|
|
command_installed $GIT_PACKAGE
|
|
if [ $? -ne 0 ]
|
|
then
|
|
os_pkgs_install $GIT_PACKAGE
|
|
fi
|
|
|
|
# Install gnupg from OS Packages
|
|
command_installed $GNUPG_PACKAGE
|
|
if [ $? -ne 0 ]
|
|
then
|
|
os_pkgs_install $GNUGP_PACKAGE
|
|
fi
|
|
|
|
# Install dialog from OS Packages
|
|
command_installed $DIALOG_PACKAGE
|
|
if [ $? -ne 0 ]
|
|
then
|
|
os_pkgs_install $ZIP_PACKAGE
|
|
fi
|
|
|
|
# Install sqlite3 from OS Packages
|
|
command_installed $SQLITE_COMMAND
|
|
if [ $? -ne 0 ]
|
|
then
|
|
os_pkgs_install $SQLITE_PACKAGE
|
|
fi
|
|
|
|
# Install python from OS Packages
|
|
command_installed $PYTHON_PACKAGE
|
|
if [ $? -ne 0 ]
|
|
then
|
|
python3_install
|
|
fi
|
|
|
|
# Install mozilla sops from OS Packages
|
|
command_installed $SOPS_PACKAGE
|
|
if [ $? -ne 0 ]
|
|
then
|
|
sops_install
|
|
fi
|
|
|
|
# Install ansible from OS Packages
|
|
command_installed $ANSIBLE_COMMAND
|
|
if [ $? -ne 0 ]
|
|
then
|
|
os_pkgs_install $ANSIBLE_PACKAGE
|
|
fi
|
|
|
|
# Check for container management installed and install podman
|
|
container_mode
|
|
if [ $? -eq 255 ]
|
|
then
|
|
# Install podman
|
|
podman_install
|
|
elif [ $? -eq 1 ]
|
|
then
|
|
echo "$domsg_005"
|
|
fi
|
|
|
|
}
|
|
|
|
# Load messages
|
|
load_bootstrap_msg $BIN_HOME $BIN_MESG $BIN_LANG
|
|
|
|
# Display Headers
|
|
display_devstools_header "- $bomsg_000"
|
|
|
|
# Run install with sudo
|
|
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
|
|
#if [ $result -eq 0 ]
|
|
#then
|
|
# Load bootstrap bash library
|
|
# source $BIN_HOME/$BIN_LIBS/bootstrap.lib
|
|
# ansible_install
|
|
#fi
|