From 06c363206dc20ff0fa946e59a506496140706cfa Mon Sep 17 00:00:00 2001 From: hp3icc Date: Thu, 19 Mar 2026 14:25:24 -0500 Subject: [PATCH] update menu --- easy-fdmr.sh | 1 + update.sh | 110 ++++++++++++++++++++++++--------------------------- 2 files changed, 53 insertions(+), 58 deletions(-) diff --git a/easy-fdmr.sh b/easy-fdmr.sh index 9f1e266..55639a0 100644 --- a/easy-fdmr.sh +++ b/easy-fdmr.sh @@ -27,6 +27,7 @@ fi apps="sudo curl git make build-essential libusb-1.0-0-dev python3 python3-pip libi2c-dev i2c-tools lm-sensors wget \ python3-dev python3-venv libffi-dev libssl-dev cargo pkg-config sed libmariadb-dev zip unzip rrdtool openssl \ wavemon gcc g++ cmake libasound2-dev libudev-dev gpsd libgps-dev gpsd-clients gpsd-tools chrony \ +mariadb-server \ libsamplerate0-dev ffmpeg php-sqlite3" check_and_install() { diff --git a/update.sh b/update.sh index 6d5e6ea..47bb8ee 100644 --- a/update.sh +++ b/update.sh @@ -305,28 +305,69 @@ sudo cat > /opt/fdmr-update.sh <<- "EOFD1" #!/bin/bash #"libapache2-mod-php" -sudo systemctl stop adn-server.service 2>/dev/null || true -sudo systemctl stop adn-parrot.service 2>/dev/null || true -sudo systemctl stop proxy.service 2>/dev/null || true -sudo systemctl stop proxy2.service 2>/dev/null || true +SERVICIOS="adn-server.service proxy.service proxy2.service adn-parrot.service" +SERVICIOS2="freedmr.service proxy.service fdmrparrot.service adn_server.service adn_proxy.service adn_parrot.service" -apps="mariadb-server php php-zip php-mbstring php-cli php-common php-curl php-xml php-mysql" +# Procesar SERVICIOS: solo detener si están activos +for servicio in $SERVICIOS; do + # Verificar si el servicio existe + if systemctl list-unit-files --type=service | grep -q "^$servicio "; then + echo "El servicio $servicio existe." + + # Verificar si el servicio está activo y detenerlo + if systemctl is-active --quiet $servicio; then + echo "El servicio $servicio está activo. Deteniendo..." + sudo systemctl stop $servicio + else + echo "El servicio $servicio no está activo." + fi + fi +done + +# Procesar SERVICIOS2: detener y deshabilitar +for servicio in $SERVICIOS2; do + # Verificar si el servicio existe + if systemctl list-unit-files --type=service | grep -q "^$servicio "; then + echo "El servicio $servicio existe." + + # Verificar si el servicio está activo y detenerlo + if systemctl is-active --quiet $servicio; then + echo "El servicio $servicio está activo. Deteniendo..." + sudo systemctl stop $servicio + else + echo "El servicio $servicio no está activo." + fi + + # Deshabilitar el servicio + echo "Deshabilitando el servicio $servicio..." + sudo systemctl disable $servicio + fi +done + +# === INSTALAR PAQUETES NECESARIOS === +apps="sudo curl git make build-essential libusb-1.0-0-dev python3 python3-pip libi2c-dev i2c-tools lm-sensors wget \ +python3-dev python3-venv libffi-dev libssl-dev cargo pkg-config sed libmariadb-dev zip unzip rrdtool openssl \ +wavemon gcc g++ cmake libasound2-dev libudev-dev gpsd libgps-dev gpsd-clients gpsd-tools chrony \ +mariadb-server \ +libsamplerate0-dev ffmpeg php-sqlite3" -# 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 + if ! dpkg -s "$app" 2>/dev/null | grep -q "Status: install ok installed"; then echo "$app no está instalado. Instalando..." - sudo apt-get install -y $app - echo "$app instalado correctamente." + 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..." + fi else echo "$app ya está instalado." fi } -# Verificar e instalar cada aplicación for app in $apps; do - check_and_install $app + check_and_install "$app" done #sudo mysql_secure_installation --host=localhost --port=3306 @@ -380,28 +421,6 @@ fi if [ -z "$SERVER_ID" ] then SERVER_ID=0000 fi -SERVICIOS="adn-server.service freedmr.service proxy.service adn-parrot.service fdmrparrot.service adn_server.service adn_proxy.service adn_parrot.service" - -for servicio in $SERVICIOS; do - # Verificar si el servicio existe - if systemctl list-unit-files --type=service | grep -q "^$servicio "; then - echo "El servicio $servicio existe." - - # Verificar si el servicio está activo - if systemctl is-active --quiet $servicio; then - echo "El servicio $servicio está activo. Deteniendo..." - sudo systemctl stop $servicio - else - echo "El servicio $servicio no está activo." - fi - - # Deshabilitar el servicio - echo "Deshabilitando el servicio $servicio..." - sudo systemctl disable $servicio - else - echo "El servicio $servicio no existe." - fi -done if [ -f "/lib/systemd/system/fdmrparrot.service" ]; then @@ -509,31 +528,6 @@ fi sudo chmod -R +x /opt/ADN-DMR-Peer-Server/* sudo chmod -R 777 /opt/ADN-DMR-Peer-Server/* -# === INSTALAR PAQUETES NECESARIOS === -apps="sudo curl git make build-essential libusb-1.0-0-dev python3 python3-pip libi2c-dev i2c-tools lm-sensors wget \ -python3-dev python3-venv libffi-dev libssl-dev cargo pkg-config sed libmariadb-dev zip unzip rrdtool openssl \ -wavemon gcc g++ cmake libasound2-dev libudev-dev gpsd libgps-dev gpsd-clients gpsd-tools chrony \ -libsamplerate0-dev ffmpeg php-sqlite3" - -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..." - 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..." - fi - else - echo "$app ya está instalado." - fi -} - -for app in $apps; do - check_and_install "$app" -done - if grep -q "VERSION_ID=\"1[23]\"" /etc/os-release; then /usr/bin/python3 -m pip install --break-system-packages -r requirements.txt else