diff --git a/install/p25.sh b/install/p25.sh index 8f18883..c4eddad 100644 --- a/install/p25.sh +++ b/install/p25.sh @@ -1,4 +1,30 @@ #!/bin/bash +# Verificar si el usuario tiene permisos de root +if [[ $EUID -ne 0 ]]; then + echo "Este script debe ejecutarse como usuario ROOT" + exit 1 +fi + +# Lista de aplicaciones para verificar e instalar +apps=("sudo" "curl" "git" "make" "build-essential" "python" "python3" "python3-pip" "chkconfig" "git-core" "lm-sensors" "python3-websockets" "python3-psutil" "wget" "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" "wavemon" "gcc" "g++" "cmake" "php") + +# 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..." + sudo apt-get install -y $app + echo "$app instalado correctamente." + else + echo "$app ya está instalado." + fi +} + +# Verificar e instalar cada aplicación +for app in "${apps[@]}"; do + check_and_install $app +done +# if [ -d "/opt/DVReflectors" ] then sudo rm -r /opt/DVReflectors @@ -121,7 +147,11 @@ timezone_escaped=$(echo "$timezone" | sed 's/\//\\\//g') # Actualizar el archivo de configuración con la zona horaria sudo sed -i "s/define(\"TIMEZONE.*/define(\"TIMEZONE\", \"$timezone_escaped\");/g" /opt/P25Reflector-Dashboard/config/config.php # -mkdir /var/www/p25 +if [ ! -d "/var/www" ] +then + sudo mkdir /var/www +fi +sudo mkdir /var/www/p25 sudo cp -R /opt/P25Reflector-Dashboard/* /var/www/p25/ rm /var/www/p25/setup.php sudo chown -R www-data:www-data /var/www/p25 diff --git a/install/p25cross.sh b/install/p25cross.sh new file mode 100644 index 0000000..91a56ba --- /dev/null +++ b/install/p25cross.sh @@ -0,0 +1,458 @@ +#!/bin/bash + +if [ ! -f "/etc/apt/sources.list.d/dvswitch.list" ] +then + cd /opt + if [ -f "/opt/buster" ] + then + rm /opt/buster* + fi +wget http://dvswitch.org/buster +sudo chmod +x buster +./buster +apt-get update -y +fi +if [ -d "/opt/p25bridge" ] +then + rm -r /opt/p25bridge +fi +if [ ! -f "/opt/Analog_Bridge/Analog_Bridge" ] +then + apt-get install Analog_Bridge -y +fi +if [ ! -f "/opt/MMDVM_Bridge/MMDVM_Bridge" ] +then + apt-get install MMDVM_Bridge -y +fi +if [ ! -f "/opt/P25Gateway/P25Gateway" ] +then + cd /opt + git clone https://github.com/g4klx/P25Clients.git + mv /opt/P25Clients/P25Gateway/ /opt/ + cd /opt/P25Gateway + make +fi +if [ ! -d "/var/log/mmdvm" ] +then + mkdir /var/log/mmdvm +fi +sudo chmod 777 /var/log/mmdvm +mkdir /opt/p25bridge +cp /opt/Analog_Bridge/* /opt/p25bridge/ +cp /opt/MMDVM_Bridge/* /opt/p25bridge/ +cp -r /opt/P25Gateway/* /opt/p25bridge/ +cp /opt/md380-emu/* /opt/p25bridge/ +sudo chmod +x /opt/p25bridge/* +######################### +sudo cat > /opt/p25bridge/Analog_Bridge_DMR.ini <<- "EOF" +[GENERAL] +decoderFallBack = true +useEmulator = false +subscriberFile = ./user.csv +exportMetadata = true + +[AMBE_AUDIO] +server = 127.0.0.1 +fromDMRPort = 31800 +toDMRPort = 31803 +ambeMode = DMR +minTxTimeMS = 2000 +gatewayDmrId = 714000125 +repeaterID = 714000126 +txTg = 37500 +txTs = 2 +colorCode = 1 + +[USRP] +server = 127.0.0.1 +toASLPort = 32801 +fromASLPort = 34801 +aslAudio = AUDIO_UNITY +agcGain = -20 +dmrAudio = AUDIO_UNITY +dmrGain = 0.35 + +EOF +sudo cat > /opt/p25bridge/Analog_Bridge_P25.ini <<- "EOF" +[GENERAL] +decoderFallBack = true +useEmulator = false +subscriberFile = ./user.csv +exportMetadata = true + +[AMBE_AUDIO] +server = 127.0.0.1 +fromDMRPort = 34800 +toDMRPort = 34803 +ambeMode = P25 +minTxTimeMS = 2000 +gatewayDmrId = 714000125 +repeaterID = 714000126 +txTg = 37500 +txTs = 2 +colorCode = 1 + +[USRP] +server = 127.0.0.1 +toASLPort = 34801 +fromASLPort = 32801 +aslAudio = AUDIO_UNITY +agcGain = -20 +dmrAudio = AUDIO_UNITY +dmrGain = 0.35 + + +EOF +sudo cat > /opt/p25bridge/MMDVM_Bridge.ini <<- "EOF" +[General] +Callsign=HP3ICC +Id=0000000 +Timeout=220 +Duplex=0 + +[Info] +RXFrequency=0 +TXFrequency=0 +Power=1 +Latitude=41.7333 +Longitude=-50.3999 +Height=0 +Location=P25 < Bridge > DMR +Description=MMDVM_Bridge +URL=https://groups.io/g/DVSwitch + +[Log] +# Logging levels, 0=No logging, 1=Debug, 2=Message, 3=Info, 4=Warning, 5=Error, 6=Fatal +DisplayLevel=0 +FileLevel=0 +FilePath=/var/log/mmdvm +FileRoot=MMDVM_Bridge + +[DMR Id Lookup] +File=/var/lib/mmdvm/DMRIds.dat +Time=24 + +[NXDN Id Lookup] +File=/var/lib/mmdvm/NXDN.csv +Time=24 + +[Modem] +Port=/dev/null +RSSIMappingFile=/dev/null +Trace=0 +Debug=0 + +[D-Star] +Enable=0 +Module=B + +[DMR] +Enable=1 +ColorCode=1 +EmbeddedLCOnly=1 +DumpTAData=0 + +[System Fusion] +Enable=0 + +[P25] +Enable=1 +NAC=293 + +[NXDN] +Enable=0 +RAN=1 +Id=12345 + +[D-Star Network] +Enable=0 +GatewayAddress=127.0.0.1 +GatewayPort=20010 +LocalPort=20011 +Debug=0 + +[DMR Network] +Enable=1 +Address=127.0.0.1 +Port=62030 +Jitter=360 +Local=62032 +Password=passw0rd +# for DMR+ see https://github.com/DVSwitch/MMDVM_Bridge/blob/master/DOC/DMRplus_startup_options.md +# for XLX the syntax is: Options=XLX:4009 +Options=XLX:4001 +Slot1=0 +Slot2=1 +Debug=0 + +[System Fusion Network] +Enable=0 +LocalAddress=0 +LocalPort=3280 +GatewayAddress=127.0.0.1 +GatewayPort=4280 +Debug=0 + +[P25 Network] +Enable=1 +GatewayAddress=127.0.0.1 +GatewayPort=42820 +LocalPort=32810 +Debug=0 + +[NXDN Network] +Enable=0 +#LocalAddress=127.0.0.1 +Debug=0 +LocalPort=14021 +GatewayAddress=127.0.0.1 +GatewayPort=14020 + + + +EOF +sudo cat > /opt/p25bridge/P25Gateway.ini <<- "EOF" +[General] +Callsign=HP3ICC +RptAddress=127.0.0.1 +RptPort=32810 +LocalPort=42820 +Debug=0 +Daemon=0 + +[Id Lookup] +Name=/var/lib/mmdvm/DMRIds.dat +Time=24 + +[Voice] +Enabled=0 +#Language=en_GB +#Directory=./Audio + +[Log] +# Logging levels, 0=No logging +DisplayLevel=0 +FileLevel=0 +FilePath=/var/log/mmdvm +FileRoot=P25Gateway +FileRotate=1 + +[Network] +Port=42810 +HostsFile1=/opt/P25Hosts2.txt +#/var/lib/mmdvm/P25Hosts.txt +#./P25Hosts.txt +ReloadTime=60 +ParrotAddress=127.0.0.1 +ParrotPort=42811 +P252DMRAddress=127.0.0.1 +P252DMRPort=42812 +# Enter your P25 TG number below: +Static=7144 +Startup=7144 +RFHangTime=120 +NetHangTime=0 +Debug=0 + +[Remote Commands] +Enable=0 +Port=6074 + +EOF +# +sudo cat > /opt/p25bridge/DVSwitch.ini <<- "EOF" +; MMDVM_Bridge export / import configuration file. +; This file should be placed along side of MMDVM_Bridge or it can be +; supplied as a path on the MMDVM_BRIDGE environment variable. + +; Configure the Quantar Repeater Partner +; Note that the TX and RX ports are already reversed for MMDVM_Bridge <--> Quantar_Bridge +[QUANTAR] +;logFilePath = /var/log/Quantar_Bridge.log +;Address = 127.0.0.1 ; Address to send AMBE TLV frames to (export) +;TXPort = 34803 ; Port to send AMBE TLV frames to (export) +;RXPort = 34800 ; Port to listen on (import) +;quantarPort = 1994 ; HDLC frames To/From the Quantar repeater +;logLevel = 2 ; Show messages and above 0=No logging, 1=Debug, 2=Message, 3=Info, 4=Warning, 5=Error, 6=Fatal +;debug = 0 ; Debug 0 = off, 1 = on (adds lots of additional messages) + +; Configure the DMR Partner +; Audio format is AMBE 72 bit +[DMR] +Address = 127.0.0.1 ; Address to send AMBE TLV frames to (export) +TXPort = 31800 ; Port to send AMBE TLV frames to (export) +RXPort = 31803 ; Port to listen on (import) +Slot = 2 ; Export slot + +; Configure the D-Star Partner +; Audio format is AMBE 48 bit (DSAMBE) +[DSTAR] +;Address = 127.0.0.1 ; Address to send AMBE TLV frames to (export) +;TXPort = 32100 ; Port to send AMBE TLV frames to (export) +;RXPort = 32103 ; Port to listen on (import) +;FallbackID = 7140001 ; In case we can not find a valid DMR id in the database, export this one +;ExportTG = 9 ; Which TG to export +;Slot = 2 ; Export slot + +; Configure the NXDN Partner +; Audio format is AMBE 72 bit +[NXDN] +;Address = 127.0.0.1 ; Address to send AMBE TLV frames to (export) +;TXPort = 33100 ; Port to send AMBE TLV frames to (export) +;RXPort = 33103 ; Port to listen on (import) +;FallbackID = 7140001 ; In case we can not find a valid DMR id in the database, export this one +;NXDNFallbackID = 12345 ; Use this ID when the input DMR ID is not found in the database +;Translate = 1234=4321 ; Translate NXDN TG < -- > DMR TG (bidirectional) +;Slot = 2 ; Export slot + +; Configure the P25 Partner +; Audio format is IMBE 88 bit +[P25] +Address = 127.0.0.1 ; Address to send AMBE TLV frames to (export) +TXPort = 34800 ; Port to send AMBE TLV frames to (export) +RXPort = 34803 ; Port to listen on (import) +Slot = 2 ; Export slot + +; Configure the Yaesu Fusion Partner +; Audio format is AMBE 72 bit +; Audio format is IMBE 88 bit +[YSF] +;Address = 127.0.0.1 ; Address to send AMBE TLV frames to (export) +;TXPort = 35100 ; Port to send AMBE TLV frames to (export) +;RXPort = 35103 ; Port to listen on (import) +;FallbackID = 7140001 ; In case we can not find a valid DMR id in the database, export this one +;ExportTG = 1234 ; Which TG to export +;Slot = 2 ; Export slot + +EOF +# +cat > /lib/systemd/system/analog_bridge1.service <<- "EOF" +[Unit] +Description=Analog_Bridge Service +# Description=Place this file in /lib/systemd/system +# Description=N4IRS 03/25/2021 + + +[Service] +User=root +Type=simple +Restart=always +RestartSec=3 +StandardOutput=null +#RestartPreventExitStatus=252 253 254 +WorkingDirectory=/opt/p25bridge +Environment=AnalogBridgeLogDir=/var/log/dvswitch +#ExecStartPre=/bin/sh -c 'until ping -c1 noip.com; do sleep 1; done;' +ExecStart=/opt/p25bridge/Analog_Bridge /opt/p25bridge/Analog_Bridge_DMR.ini +#Analog_Bridge.ini +ExecStartPost= -/usr/local/sbin/update-config.sh + +[Install] +WantedBy=multi-user.target + +# 254 matching IDs +# 253 ini parse errors +# 252 dv3000 not found, fallback not enabled + +EOF +# +cat > /lib/systemd/system/analog_bridge2.service <<- "EOF" +[Unit] +Description=Analog_Bridge Service2 +# Description=Place this file in /lib/systemd/system +# Description=N4IRS 03/25/2021 + + +[Service] +User=root +Type=simple +Restart=always +RestartSec=3 +StandardOutput=null +#RestartPreventExitStatus=252 253 254 +WorkingDirectory=/opt/p25bridge +Environment=AnalogBridgeLogDir=/var/log/dvswitch +#ExecStartPre=/bin/sh -c 'until ping -c1 noip.com; do sleep 1; done;' +ExecStart=/opt/p25bridge/Analog_Bridge /opt/p25bridge/Analog_Bridge_P25.ini +#Analog_Bridge.ini +ExecStartPost= -/usr/local/sbin/update-config.sh + +[Install] +WantedBy=multi-user.target + +# 254 matching IDs +# 253 ini parse errors +# 252 dv3000 not found, fallback not enabled + +EOF +# +cat > /lib/systemd/system/mmdvm_bridgeP25b.service <<- "EOF" +[Unit] +Description=MMDVM_Bridge Service +# Description=Place this file in /lib/systemd/system +# Description=N4IRS 10/16/2020 + + +[Service] +User=root +Type=simple +Restart=always +RestartSec=3 +StandardOutput=null +WorkingDirectory=/opt/p25bridge +#ExecStartPre=/bin/sh -c 'until ping -c1 noip.com; do sleep 1; done;' +ExecStart=/opt/p25bridge/MMDVM_Bridge /opt/p25bridge/MMDVM_Bridge.ini + + +[Install] +WantedBy=multi-user.target + + +EOF +# +cat > /lib/systemd/system/p25gatewayP25b.service <<- "EOF" +[Unit] +Description=P25 Gateway Service +# Description=Place this file in /lib/systemd/system +# Description=N4IRS 04/20/2018 + + +[Service] +User=root +Type=simple +Restart=always +RestartSec=3 +StandardOutput=null +WorkingDirectory=/opt/p25bridge +ExecStartPre=/bin/sh -c 'until ping -c1 noip.com; do sleep 1; done;' +ExecStart=/opt/p25bridge/P25Gateway /opt/p25bridge/P25Gateway.ini + + +[Install] +WantedBy=multi-user.target + +EOF +# +cat > /lib/systemd/system/md380-emuP25b.service <<- "EOF" +[Unit] +Description=MD-380 Emulator p25bridge +# Description=Place this file in /lib/systemd/system +# Description=N4IRS 10/04/2020 + +[Service] +User=root +Type=simple +Restart=always +RestartSec=3 +StandardOutput=null +WorkingDirectory=/opt/user06 +#ExecStartPre=/bin/sh -c 'until ping -c1 noip.com; do sleep 1; done;' +ExecStart=/usr/bin/qemu-arm-static /opt/p25bridge/md380-emu -S 2876 + + +[Install] + +WantedBy=multi-user.target + +EOF +sudo systemctl daemon-reload diff --git a/menu/menu-p25r b/menu/menu-p25r index 411fd80..dc3b936 100644 --- a/menu/menu-p25r +++ b/menu/menu-p25r @@ -24,7 +24,8 @@ choix=$(whiptail --title "Raspbian Proyect HP3ICC Menu P25Reflector" --menu "Sub 6 " Editar Puerto http " \ 7 " enable setup.php " \ 8 " remove setup.php " \ -9 " Menu Principal " 3>&1 1>&2 2>&3) +9 " P25Bbridge <> XLX/DMR " \ +10 " Menu Principal " 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then @@ -110,6 +111,180 @@ if [ -f "/var/www/p25/setup.php" ] whiptail --title "P25Reflector" --msgbox "setup.php is not enabled / setup.php no esta habilitado" 0 50 fi ;; 9) +menu-p25b + ;; +10) +break + ;; +esac +done +exit 0 +EOF +############################################################# +sudo cat > /bin/menu-p25b <<- "EOF" +#!/bin/bash +while : ; do +choix=$(whiptail --title "Raspbian Proyect HP3ICC Menu P25Bridge" --menu "Suba o Baje con las flechas del teclado y seleccione el numero de opcion" 20 50 11 \ +1 " Easy setup P25Bridge " \ +2 " Iniciar Bridge " \ +3 " Detener Bridge " \ +4 " Config P25Host " \ +5 " Config P25Gateway.ini " \ +6 " Config MMDVM_bridge.ini " \ +7 " Menu Principal " 3>&1 1>&2 2>&3) +exitstatus=$? + +if [ $exitstatus = 0 ]; then + echo "Your chosen option:" $choix +else + echo "You chose cancel." + break +fi + +case $choix in +1) + mcall="" + mid="" + midg="" + p25id"" + sbridge"" + txtg"" + sport"" + spass"" + sopti"" + whiptail --title "Easy setup P25Bridge" --inputbox "Calsign:" 10 60 2>/tmp/mcall.txt + mcall=$(cat /tmp/mcall.txt) + mcall=$(echo "$mcall" | tr '[:lower:]' '[:upper:]') + whiptail --title "Easy setup P25Bridge" --inputbox "DMRId:" 10 60 2>/tmp/mid.txt + mid=$(cat /tmp/mid.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "P25 Number ID Reflector:" 10 60 2>/tmp/p25id.txt + p25id=$(cat /tmp/p25id.txt) + network=$(whiptail --title "Easy setup P25Bridge" --menu "Select a network:" 10 60 2 \ + "1" "Connect to DMR Network" \ + "2" "Connect to XLX Network" 3>&1 1>&2 2>&3) + +case "$network" in + "1") + whiptail --title "Easy setup P25Bridge" --inputbox "DMR Device id 01-99:" 10 60 2>/tmp/midg.txt + midg=$(cat /tmp/midg.txt) + + whiptail --title "Easy setup P25Bridge" --inputbox "IP or dns server DMR:" 10 60 2>/tmp/sbridge.txt + sbridge=$(cat /tmp/sbridge.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "Port server DMR:" 10 60 2>/tmp/sport.txt + sport=$(cat /tmp/sport.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "Password server DMR:" 10 60 2>/tmp/spass.txt + spass=$(cat /tmp/spass.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "TalkGroup / tg sample: 91" 10 60 2>/tmp/txtg.txt + txtg=$(cat /tmp/txtg.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "Line Options / sample: TS2=91; " 10 60 2>/tmp/sopti.txt + sopti=$(cat /tmp/sopti.txt) + + # Modify the MMDVM_Bridge.ini file for DMR + sudo sed -i "3s/Id=.*/Id=${mid}${midg}/" /opt/p25bridge/MMDVM_Bridge.ini + ;; + "2") + whiptail --title "Easy setup P25Bridge" --inputbox "IP or dns server XLXD:" 10 60 2>/tmp/sbridge.txt + sbridge=$(cat /tmp/sbridge.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "Port server XLXD:" 10 60 2>/tmp/sport.txt + sport=$(cat /tmp/sport.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "Password server XLXD:" 10 60 2>/tmp/spass.txt + spass=$(cat /tmp/spass.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "TalkGroup / tg sample: 91" 10 60 2>/tmp/txtg.txt + txtg=$(cat /tmp/txtg.txt) + whiptail --title "Easy setup P25Bridge" --inputbox "Line Options / sample: XLX:4001 " 10 60 2>/tmp/sopti.txt + sopti=$(cat /tmp/sopti.txt) + # Modify the MMDVM_Bridge.ini file for XLX + sudo sed -i "3s/Id=.*/Id=${mid}/" /opt/p25bridge/MMDVM_Bridge.ini + ;; + *) + echo "Invalid selection" + ;; +esac + + sudo sed -i "13s/gatewayDmrId =.*/gatewayDmrId = ${mid}25/g" /opt/p25bridge/Analog_Bridge_DMR.ini + sudo sed -i "14s/repeaterID =.*/repeaterID = ${mid}26/g" /opt/p25bridge/Analog_Bridge_DMR.ini + sudo sed -i "15s/txTg =.*/txTg = ${txtg}/g" /opt/p25bridge/Analog_Bridge_DMR.ini + + sudo sed -i "13s/gatewayDmrId =.*/gatewayDmrId = ${mid}25/g" /opt/p25bridge/Analog_Bridge_P25.ini + sudo sed -i "14s/repeaterID =.*/repeaterID = ${mid}26/g" /opt/p25bridge/Analog_Bridge_P25.ini + sudo sed -i "15s/txTg =.*/txTg = ${txtg}/g" /opt/p25bridge/Analog_Bridge_P25.ini + + sudo sed -i "2s/Callsign=.*/Callsign=$mcall/g" /opt/p25bridge/MMDVM_Bridge.ini + #sudo sed -i "3s/Id=.*/Id=$mid$midg/" /opt/p25bridge/MMDVM_Bridge.ini + sudo sed -i "70s/Address=.*/Address=$sbridge/" /opt/p25bridge/MMDVM_Bridge.ini + sudo sed -i "71s/Port=.*/Port=$sport/" /opt/p25bridge/MMDVM_Bridge.ini + sudo sed -i "74s/Password=.*/Password=$spass/" /opt/p25bridge/MMDVM_Bridge.ini + sudo sed -i "77s/Options=.*/Options=$sopti/" /opt/p25bridge/MMDVM_Bridge.ini + + sudo sed -i "2s/Callsign=.*/Callsign=$mcall/g" /opt/p25bridge/P25Gateway.ini + sudo sed -i "37s/Static=.*/Static=$p25id/g" /opt/p25bridge/P25Gateway.ini + sudo sed -i "38s/Startup=.*/Startup=$p25id/g" /opt/p25bridge/P25Gateway.ini + + input_file="/var/lib/mmdvm/P25Hosts.txt" + output_file="/opt/P25Hosts2.txt" + grep -w "^$p25id" "$input_file" > "$output_file" + + rm -f /tmp/mcall.txt /tmp/mid.txt /tmp/p25id.txt /tmp/sbridge.txt /tmp/sport.txt /tmp/sopti.txt /tmp/midg.txt /tmp/spass.txt + +#!/bin/bash + +# Lista de servicios a reiniciar +servicios=("md380-emuP25b.service" "analog_bridge1.service" "analog_bridge2.service" "mmdvm_bridgeP25b.service" "p25gatewayP25b.service") + +# Recorre la lista de servicios y verifica si están activos +for servicio in "${servicios[@]}"; do + if systemctl status "$servicio" | grep "service; enabled;" >/dev/null 2>&1; then + echo "restart $servicio" + sudo systemctl restart "$servicio" + else + echo "start $servicio" + sudo systemctl restart "$servicio" + sudo systemctl enable "$servicio" + fi +done + whiptail --title "Easy setup P25Bridge" --msgbox "Configuracion finalizada" 0 50 + + ;; +2) +#!/bin/bash + +# Lista de servicios a reiniciar +servicios=("md380-emuP25b.service" "analog_bridge1.service" "analog_bridge2.service" "mmdvm_bridgeP25b.service" "p25gatewayP25b.service") + +# Recorre la lista de servicios y verifica si están activos +for servicio in "${servicios[@]}"; do + if systemctl status "$servicio" | grep "service; enabled;" >/dev/null 2>&1; then + echo "restart $servicio" + sudo systemctl restart "$servicio" + else + echo "start $servicio" + sudo systemctl restart "$servicio" + sudo systemctl enable "$servicio" + fi +done + ;; +3) +#!/bin/bash + +# Lista de servicios a reiniciar +servicios=("md380-emuP25b.service" "analog_bridge1.service" "analog_bridge2.service" "mmdvm_bridgeP25b.service" "p25gatewayP25b.service") + +# Recorre la lista de servicios y verifica si están activos +for servicio in "${servicios[@]}"; do + if systemctl status "$servicio" | grep "service; enabled;" >/dev/null 2>&1; then + echo "stop $servicio" + sudo systemctl disable "$servicio" + sudo systemctl stop "$servicio" + fi +done + ;; +4) +sudo nano /opt/P25Hosts2.txt ;; +5) +sudo nano /opt/p25bridge/P25Gateway.ini ;; +6) +sudo nano /opt/p25bridge/MMDVM_Bridge.ini ;; +7) break ;; esac @@ -117,6 +292,8 @@ done exit 0 EOF ######### -chmod +x /bin/menu-p25r +sudo chmod +x /bin/menu-p25r +sudo chmod +x /bin/menu-p25b ln -sf /bin/menu-p25r /bin/MENU-P25R -chmod +x /bin/MENU* +ln -sf /bin/menu-p25b /bin/MENU-P25B +sudo chmod +x /bin/MENU*