From 520f5371a0c3c644e5e300c78e3c9bdeb1294b0e Mon Sep 17 00:00:00 2001 From: Esteban Mackay Q Date: Tue, 29 Aug 2023 15:34:27 -0500 Subject: [PATCH] update --- easy-fdmr.sh | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++- install.sh | 101 +++---------------------------------------------- 2 files changed, 110 insertions(+), 96 deletions(-) diff --git a/easy-fdmr.sh b/easy-fdmr.sh index 0f7f5a2..8007f14 100644 --- a/easy-fdmr.sh +++ b/easy-fdmr.sh @@ -1,4 +1,107 @@ -#!/bin/sh +#!/bin/bash +# Actualizar la lista de paquetes una vez al principio +sudo apt-get update + +# Función para verificar e instalar una aplicación +check_and_install() { + app=$1 + if ! dpkg -s $app >/dev/null 2>&1; then + echo "$app no está instalado. Instalando..." + sudo apt-get install $app -y + echo "$app instalado correctamente." + else + echo "Verificando si hay actualizaciones para $app..." + available_version=$(apt-cache policy $app | grep 'Candidate' | awk '{print $2}') + current_version=$(dpkg -s $app | grep 'Version' | awk '{print $2}') + + if [ "$available_version" != "$current_version" ]; then + echo "Hay una versión actualizada de $app disponible. Actualizando..." + sudo apt-get install --only-upgrade $app -y + echo "$app actualizado correctamente." + else + echo "$app ya está instalado y actualizado." + fi + fi +} + +# Lista de aplicaciones para verificar e instalar +apps=("wget" "git" "sudo" "python3" "python3-pip" "python3-dev" "python3-venv" "libffi-dev" "libssl-dev" "cargo" "pkg-config" "sed" "default-libmysqlclient-dev" "libmysqlclient-dev" "build-essential" "zip" "unzip" "python3-distutils" "python3-twisted" "python3-bitarray" "rrdtool" "openssl" "mariadb-server" "php" "libapache2-mod-php" "php-zip" "php-mbstring" "php-cli" "php-common" "php-curl" "php-xml" "php-mysql") + +# Verificar e instalar cada aplicación +for app in "${apps[@]}"; do + check_and_install $app +done + +# Verificar y actualizar python3-venv si no está instalado +if ! dpkg -s python3-venv >/dev/null 2>&1; then + echo "python3-venv no está instalado. Instalando..." + sudo 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 +wget https://bootstrap.pypa.io/pip/get-pip.py +python3 get-pip.py +rm get-pip.py + +# Instalar paquetes en el entorno virtual +sudo apt install -y libssl-dev +python3 -m pip install --no-cache-dir --upgrade pip setuptools +python3 -m pip install --no-cache-dir cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 markupsafe bitarray configparser aprslib attrs + +# Instalar Rust y configurar versión +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +source $HOME/.cargo/env + +rustup install 1.71.1 +rustup default 1.71.1 + +pip install --no-cache-dir --upgrade bitstring +pip install --no-cache-dir --upgrade bitarray +pip install --no-cache-dir --upgrade Twisted +pip install --no-cache-dir --upgrade dmr_utils3 +pip install --no-cache-dir --upgrade configparser +pip install --no-cache-dir --upgrade aprslib +pip install --no-cache-dir --upgrade pynmea2 +pip install --no-cache-dir --upgrade maidenhead +pip install --no-cache-dir --upgrade flask +pip install --no-cache-dir --upgrade folium +pip install --no-cache-dir --upgrade mysql-connector +pip install --no-cache-dir --upgrade mysql-connector-python +pip install --no-cache-dir --upgrade resettabletimer +pip install --no-cache-dir --upgrade setproctitle +pip install --no-cache-dir --upgrade requests +pip install --no-cache-dir --upgrade libscrc +pip install --no-cache-dir --upgrade cryptography +pip install --no-cache-dir --upgrade pyopenssl +pip install --no-cache-dir --upgrade autobahn +pip install --no-cache-dir --upgrade jinja2 +pip install --no-cache-dir --upgrade MarkupSafe +pip install --no-cache-dir --upgrade attrs +pip install --no-cache-dir --upgrade setuptools +pip install --no-cache-dir --upgrade wheel +pip install --no-cache-dir --upgrade service_identity +pip install --no-cache-dir --upgrade pyOpenSSL +pip install --no-cache-dir --upgrade mysqlclient +pip install --no-cache-dir --upgrade tinydb +pip install --no-cache-dir --upgrade ansi2html +pip install --no-cache-dir --upgrade mysql-connector-python +pip install --no-cache-dir --upgrade pandas +pip install --no-cache-dir --upgrade xlsxwriter +pip install --no-cache-dir --upgrade cursor +pip install --no-cache-dir --upgrade Pyro5 +#EOF +# Desactivar el entorno virtual +deactivate + +echo "Instalación completa." + +####### bash -c "$(curl -fsSL https://gitlab.com/hp3icc/fdmr/-/raw/main/install.sh)" sudo systemctl start freedmr.service sudo systemctl enable freedmr.service diff --git a/install.sh b/install.sh index 3c19b45..641fa4e 100644 --- a/install.sh +++ b/install.sh @@ -5,94 +5,7 @@ if [[ $EUID -ne 0 ]]; then echo "Este script debe ejecutarse como usuario ROOT" exit 1 fi - -# Actualizar la lista de paquetes una vez al principio -sudo apt-get update - -# Función para verificar e instalar una aplicación -check_and_install() { - app=$1 - if ! dpkg -s $app >/dev/null 2>&1; then - echo "$app no está instalado. Instalando..." - sudo apt-get install $app -y - echo "$app instalado correctamente." - else - echo "Verificando si hay actualizaciones para $app..." - available_version=$(apt-cache policy $app | grep 'Candidate' | awk '{print $2}') - current_version=$(dpkg -s $app | grep 'Version' | awk '{print $2}') - - if [ "$available_version" != "$current_version" ]; then - echo "Hay una versión actualizada de $app disponible. Actualizando..." - sudo apt-get install --only-upgrade $app -y - echo "$app actualizado correctamente." - else - echo "$app ya está instalado y actualizado." - fi - fi -} - -# Lista de aplicaciones para verificar e instalar -apps=("wget" "git" "sudo" "python3" "python3-pip" "python3-dev" "python3-venv" "libffi-dev" "libssl-dev" "cargo" "pkg-config" "sed" "default-libmysqlclient-dev" "libmysqlclient-dev" "build-essential" "zip" "unzip" "python3-distutils" "python3-twisted" "python3-bitarray" "rrdtool" "openssl" "mariadb-server" "php" "libapache2-mod-php" "php-zip" "php-mbstring" "php-cli" "php-common" "php-curl" "php-xml" "php-mysql") - -# Verificar e instalar cada aplicación -for app in "${apps[@]}"; do - check_and_install $app -done - -# Verificar y actualizar python3-venv si no está instalado -if ! dpkg -s python3-venv >/dev/null 2>&1; then - echo "python3-venv no está instalado. Instalando..." - sudo 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 -wget https://bootstrap.pypa.io/pip/get-pip.py -python3 get-pip.py -rm get-pip.py - -# Instalar paquetes en el entorno virtual -sudo apt install -y libssl-dev -python3 -m pip install --no-cache-dir --upgrade pip setuptools -python3 -m pip install --no-cache-dir cryptography pyopenssl autobahn Twisted dmr_utils3 bitstring jinja2 markupsafe bitarray configparser aprslib attrs - -# Instalar Rust y configurar versión -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -source $HOME/.cargo/env - -rustup install 1.71.1 -rustup default 1.71.1 - -pip install --no-cache-dir --upgrade cryptography -pip install --no-cache-dir --upgrade pyopenssl -pip install --no-cache-dir --upgrade autobahn -pip install --no-cache-dir --upgrade Twisted -pip install --no-cache-dir --upgrade dmr_utils3 -pip install --no-cache-dir --upgrade bitstring -pip install --no-cache-dir --upgrade jinja2 -pip install --no-cache-dir --upgrade MarkupSafe -pip install --no-cache-dir --upgrade bitarray -pip install --no-cache-dir --upgrade configparser -pip install --no-cache-dir --upgrade aprslib -pip install --no-cache-dir --upgrade attrs -pip install --no-cache-dir --upgrade setuptools -pip install --no-cache-dir --upgrade wheel -pip install --no-cache-dir --upgrade service_identity -pip install --no-cache-dir --upgrade pyOpenSSL -pip install --no-cache-dir --upgrade mysqlclient -pip install --no-cache-dir --upgrade tinydb -pip install --no-cache-dir --upgrade ansi2html -# Desactivar el entorno virtual -deactivate - -echo "Instalación completa." - -############## +####### cd / ###################################################################################################################### @@ -315,8 +228,8 @@ commands="CREATE DATABASE IF NOT EXISTS \`${newDb}\`;CREATE USER IF NOT EXISTS ' echo "${commands}" | /usr/bin/mysql -u root ################# #FDMR Server -sudo -H pip3 install --upgrade pip -pip install pyopenssl --upgrade +#sudo -H pip3 install --upgrade pip +#pip install pyopenssl --upgrade cd /opt git clone https://gitlab.hacknix.net/hacknix/FreeDMR.git sudo rm /opt/FreeDMR/hotspot_proxy_v2.py @@ -324,10 +237,8 @@ cd FreeDMR mkdir config mkdir /var/log/FreeDMR sudo chmod +x /opt/FreeDMR/* -python3 -m venv env0 && -source env0/bin/activate && -./install.sh -deactivate +#./install.sh + sudo cat > /opt/conf.txt <<- "EOF" [D-APRS] @@ -485,7 +396,7 @@ done sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/html/*.* sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/sysinfo/*.* # Install the required support programs -sudo pip install -U -r requirements.txt +#sudo pip install -U -r requirements.txt cd /opt/FDMR-Monitor/ cp /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg /opt/FDMR-Monitor/fdmr-mon.cfg ###############################