mirror of https://gitlab.com/hp3icc/emq-TE1.git
69 lines
2.1 KiB
Bash
69 lines
2.1 KiB
Bash
#!/bin/bash
|
|
SCRIPT_NAME="app.sh"
|
|
|
|
# Registra el inicio en /opt/curl.txt
|
|
echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt
|
|
apps="sudo curl git make build-essential cmake python3-pip python3-websockets python3-argon2 python3-aiohttp python3-aiohttp-session python3-venv"
|
|
|
|
# Función para verificar e instalar una aplicación
|
|
check_and_install() {
|
|
app=$1
|
|
if ! dpkg -s $app 2>/dev/null | grep -q "Status: install ok installed"; then
|
|
echo "$app no está instalado. Instalando..."
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y $app || true
|
|
if dpkg -s $app 2>/dev/null | grep -q "Status: install ok installed"; then
|
|
echo "$app instalado correctamente."
|
|
else
|
|
echo "No se pudo instalar $app. Continuando con la siguiente aplicación..."
|
|
fi
|
|
else
|
|
echo "$app ya está instalado."
|
|
fi
|
|
}
|
|
|
|
# Verificar e instalar cada aplicación
|
|
for app in $apps; do
|
|
check_and_install $app
|
|
done
|
|
|
|
if ! dpkg -s python3-venv >/dev/null 2>&1; then
|
|
echo "python3-venv no está instalado. Instalando..."
|
|
apt-get install python3-venv -y
|
|
echo "python3-venv instalado correctamente."
|
|
fi
|
|
|
|
# Crear y activar un entorno virtual
|
|
cd /opt/
|
|
python3 -m venv myenv
|
|
source myenv/bin/activate
|
|
|
|
# Instalar pip en el entorno virtual
|
|
if [ -f "/opt/get-pip.py" ]
|
|
then
|
|
rm /opt/get-pip.*
|
|
fi
|
|
wget https://bootstrap.pypa.io/pip/get-pip.py
|
|
python3 get-pip.py
|
|
rm get-pip.*
|
|
|
|
# Instalar paquetes en el entorno virtual
|
|
apt-get install -y libssl-dev
|
|
|
|
if [ -f "/etc/os-release" ]; then
|
|
source /etc/os-release
|
|
|
|
if [ "$VERSION_ID" == "12" ]; then
|
|
/usr/bin/python3 -m pip install --break-system-packages setuptools
|
|
else
|
|
/usr/bin/python3 -m pip install --upgrade setuptools
|
|
fi
|
|
fi
|
|
|
|
# Desactivar el entorno virtual
|
|
deactivate
|
|
|
|
#pip install cryptography pyopenssl autobahn Twisted bitstring MarkupSafe bitarray configparser aprslib attrs wheel service_identity pyOpenSSL mysqlclient tinydb ansi2html mysql-connector-python pandas xlsxwriter cursor pynmea2 maidenhead flask folium mysql-connector resettabletimer setproctitle requests libscrc Pyro5
|
|
|
|
cd /opt
|
|
echo "Finalizado: $SCRIPT_NAME" >> /opt/curl.txt
|