From dced0aa28df0d29537b7e1f245ce9597b5628507 Mon Sep 17 00:00:00 2001 From: Esteban Mackay Q <49044505+hp3icc@users.noreply.github.com> Date: Mon, 7 Aug 2023 08:50:33 -0500 Subject: [PATCH] Update update.sh --- update.sh | 697 +----------------------------------------------------- 1 file changed, 1 insertion(+), 696 deletions(-) diff --git a/update.sh b/update.sh index e649bb1..faba54f 100644 --- a/update.sh +++ b/update.sh @@ -1,698 +1,3 @@ #!/bin/bash -cd / -# -sudo cat > /bin/menu-fdmr <<- "EOF" -#!/bin/bash -while : ; do -choix=$(whiptail --title "Raspbian Proyect HP3ICC FDMR+" --menu "move up or down with the keyboard arrows and select your option by pressing enter:" 23 56 13 \ -1 " Edit FreeDMR Server " \ -2 " Edit Interlink " \ -3 " Edit FDMR-Monitor " \ -4 " Edit Port HTTP " \ -5 " Start-Restart FreeDMR Server " \ -6 " Start-Restart FDMR-Monitor " \ -7 " Stop FreeDMR SERVER " \ -8 " Stop FDMR-Monitor " \ -9 " Menu update " 3>&1 1>&2 2>&3) -exitstatus=$? -#on recupere ce choix -#exitstatus=$? -if [ $exitstatus = 0 ]; then - echo "Your chosen option:" $choix -else - echo "You chose cancel."; break; -fi -# case : action en fonction du choix -case $choix in -1) -sudo nano /opt/FreeDMR/config/FreeDMR.cfg ;; -2) -sudo nano /opt/FreeDMR/config/rules.py ;; -3) -sudo nano /opt/FDMR-Monitor/fdmr-mon.cfg ;; -4) -sudo nano /lib/systemd/system/http.server-fdmr.service && systemctl daemon-reload && systemctl restart http.server-fdmr.service ;; -5) -sudo systemctl stop fdmrparrot.service -sudo systemctl start fdmrparrot.service -sudo systemctl enable fdmrparrot.service -sudo systemctl stop proxy.service -sudo systemctl start proxy.service -sudo systemctl enable proxy.service -sudo systemctl stop freedmr.service -sudo systemctl start freedmr.service -sudo systemctl enable freedmr.service ;; -6) -sudo systemctl stop fdmr_mon.service -sudo systemctl start fdmr_mon.service -sudo systemctl enable fdmr_mon.service -sudo systemctl stop http.server-fdmr.service -sudo systemctl start http.server-fdmr.service -sudo systemctl enable http.server-fdmr.service;; -7) -sudo systemctl stop fdmrparrot.service -sudo systemctl disable fdmrparrot.service -sudo systemctl stop proxy.service -sudo systemctl disable proxy.service -sudo systemctl stop freedmr.service -sudo systemctl disable freedmr.service ;; -8) -sudo systemctl stop fdmr_mon.service -sudo systemctl disable fdmr_mon.service -sudo systemctl stop http.server-fdmr.service -sudo systemctl disable http.server-fdmr.service;; -9) -sh -c "$(curl -fsSL https://gitlab.com/hp3icc/fdmr/-/raw/main/update.sh)"; -esac -done -exit 0 -EOF -### -chmod +x /bin/menu-fdmr - -sudo cat > /bin/menu-update <<- "EOF" -#!/bin/bash -while : ; do -choix=$(whiptail --title "Raspbian Proyect HP3ICC / update FDMR-Monitor OA4DOA" --menu "Nota Importante: antes de iniciar la actualizacion, el proceso de actualizacion borrara por completo todas las configuraciones, al finalizar la actualizacion el servicio se reinniciara automaticamente. -" 17 50 4 \ -1 " Update FreeDMR " \ -2 " Update FDMR-Monitor " \ -3 " Menu Principal " 3>&1 1>&2 2>&3) -exitstatus=$? -#on recupere ce choix -#exitstatus=$? -if [ $exitstatus = 0 ]; then - echo "Your chosen option:" $choix -else - echo "You chose cancel."; break; -fi -# case : action en fonction du choix -case $choix in -1) -menu-up-fdm ;; -2) -menu-up-fdmon ;; -3) -break; -esac -done -exit 0 - - -EOF -# - -sudo cat > /bin/menu-up-fdm <<- "EOF" -#!/bin/bash -while : ; do -choix=$(whiptail --title "Raspbian Proyect HP3ICC / update FreeDMR" --menu "Nota Importante: debe debe agregar todos sus obp en la opcion numero uno, ( 1-Lista de OBP )antes de iniciar la actualizacion, el proceso de actualizacion borrara por completo la carpeta /opt/FreeDMR, al finalizar la actualizacion el servicio Freedmr se reinniciara automaticamente. -" 18 55 5 \ -1 " List OBP " \ -2 " List Rules " \ -3 " shell extra " \ -4 " Iniciar Actualizacion FreeDMR " \ -5 " Menu Principal " 3>&1 1>&2 2>&3) -exitstatus=$? -#on recupere ce choix -#exitstatus=$? -if [ $exitstatus = 0 ]; then - echo "Your chosen option:" $choix -else - echo "You chose cancel."; break; -fi -# case : action en fonction du choix -case $choix in -1) -sudo nano /opt/obp.txt ;; -2) -sudo nano /opt/rules.txt ;; -3) -sudo nano /opt/extra-1.sh && chmod +x /opt/extra* ;; -4) -sh /opt/fdmr-update.sh ;; -5) -break; -esac -done -exit 0 -EOF -# -# -sudo cat > /bin/menu-up-fdmon <<- "EOF" -#!/bin/bash -while : ; do -choix=$(whiptail --title "Raspbian Proyect HP3ICC / update FDMR-Monitor OA4DOA" --menu "Nota Importante: antes de iniciar la actualizacion, el proceso de actualizacion borrara por completo todas las configuraciones, al finalizar la actualizacion el servicio se reinniciara automaticamente. -" 17 50 4 \ -1 " shell extra " \ -2 " Iniciar Actualizacion FDMR-Monitor " \ -3 " Menu Principal " 3>&1 1>&2 2>&3) -exitstatus=$? -#on recupere ce choix -#exitstatus=$? -if [ $exitstatus = 0 ]; then - echo "Your chosen option:" $choix -else - echo "You chose cancel."; break; -fi -# case : action en fonction du choix -case $choix in -1) -sudo nano /opt/extra-2.sh && chmod +x /opt/extra* ;; -2) -sh /opt/monitor-update.sh ;; -3) -break; -esac -done -exit 0 - - -EOF -######################################### FreeDMR Update ############################################################### -sudo cat > /opt/conf.txt <<- "EOFA1" - -[D-APRS] -MODE: MASTER -ENABLED: True -REPEAT: False -MAX_PEERS: 1 -EXPORT_AMBE: False -IP: -PORT: 52555 -PASSPHRASE: -GROUP_HANGTIME: 0 -USE_ACL: True -REG_ACL: DENY:1 -SUB_ACL: DENY:1 -TGID_TS1_ACL: PERMIT:ALL -TGID_TS2_ACL: PERMIT:ALL -DEFAULT_UA_TIMER: 10 -SINGLE_MODE: False -VOICE_IDENT: False -TS1_STATIC: -TS2_STATIC: -DEFAULT_REFLECTOR: 0 -ANNOUNCEMENT_LANGUAGE: es_ES -GENERATOR: 2 -ALLOW_UNREG_ID: True -PROXY_CONTROL: False -OVERRIDE_IDENT_TG: - -[EchoTest] -MODE: PEER -ENABLED: True -LOOSE: True -EXPORT_AMBE: False -IP: -#127.0.0.1 -PORT: 49060 -MASTER_IP: 127.0.0.1 -MASTER_PORT: 49061 -PASSPHRASE: passw0rd -CALLSIGN: ECHOTEST -RADIO_ID: 9990 -RX_FREQ: 449000000 -TX_FREQ: 444000000 -TX_POWER: 25 -COLORCODE: 1 -SLOTS: 3 -LATITUDE: 38.0000 -LONGITUDE: -095.0000 -HEIGHT: 75 -LOCATION: Local Parrot -DESCRIPTION: This is a cool repeater -URL: www.w1abc.org -SOFTWARE_ID: 20170620 -PACKAGE_ID: MMDVM_HBlink -GROUP_HANGTIME: 3 -OPTIONS: -#TS2=9990;DIAL=0;VOICE=0;TIMER=0 -USE_ACL: True -SUB_ACL: DENY:1 -TGID_TS1_ACL: DENY:ALL -TGID_TS2_ACL: PERMIT:9990 -TS1_STATIC: -TS2_STATIC:9990 -DEFAULT_REFLECTOR: 0 -ANNOUNCEMENT_LANGUAGE: en_GB -GENERATOR: 0 -DEFAULT_UA_TIMER: 999 -SINGLE_MODE: True -VOICE_IDENT: False - -EOFA1 -## -sudo cat > /opt/fdmr-update.sh <<- "EOF" -#!/bin/bash -variable=$(grep "SERVER_ID:" /opt/FreeDMR/config/FreeDMR.cfg | grep -Eo '[0-9]{1,9}') -if [ -z "$variable" ] -then variable=0000 - -fi -sudo systemctl stop freedmr.service -sudo systemctl stop proxy.service -sudo systemctl stop fdmrparrot.service -rm -r /opt/FreeDMR -cd /opt -git clone https://gitlab.hacknix.net/hacknix/FreeDMR.git -sudo rm /opt/FreeDMR/hotspot_proxy_v2.py -cd FreeDMR -mkdir config -mkdir /var/log/FreeDMR -chmod +x /opt/FreeDMR/install.sh -./install.sh -# -cp /opt/FreeDMR/FreeDMR-SAMPLE.cfg /opt/FreeDMR-SAMPLE.cfg -cd /opt/ -sudo cat FreeDMR-SAMPLE.cfg conf.txt obp.txt >> /opt/FreeDMR/config/FreeDMR.cfg -sudo sed -i 's/file-timed/console-timed/' /opt/FreeDMR/config/FreeDMR.cfg -sudo sed -i 's/INFO/DEBUG/' /opt/FreeDMR/config/FreeDMR.cfg -sudo sed -i 's/freedmr.log/\/var\/log\/FreeDMR\/FreeDMR.log/' /opt/FreeDMR/config/FreeDMR.cfg -sudo sed -i 's/ANNOUNCEMENT_LANGUAGE: en_GB/ANNOUNCEMENT_LANGUAGE: CW/' /opt/FreeDMR/config/FreeDMR.cfg -#sudo sed -i "s/TGID_URL:/#TGID_URL:/g" /opt/FreeDMR/config/FreeDMR.cfg -#sed '37 a TGID_URL: https://freedmr.cymru/talkgroups/talkgroup_ids_json.php' -i /opt/FreeDMR/config/FreeDMR.cfg -sudo sed -i "s/SERVER_ID: .*/SERVER_ID: $variable/g" /opt/FreeDMR/config/FreeDMR.cfg - -rm /opt/conf.txt -rm /opt/FreeDMR-SAMPLE.cfg - -cd /opt/FreeDMR/ -mv loro.cfg /opt/FreeDMR/playback.cfg -sudo sed -i 's/54915/49061/' /opt/FreeDMR/playback.cfg -sudo cat /opt/rules.txt >> /opt/FreeDMR/config/rules.py -sudo chmod +x /opt/FreeDMR/config/* - -cp /opt/FDMR-Monitor/proxy/hotspot_proxy_v2.py /opt/FreeDMR/hotspot_proxy_v2.py -cp /opt/FDMR-Monitor/proxy/proxy.cfg /opt/FreeDMR/proxy.cfg -cp /opt/FDMR-Monitor/proxy/proxy_db.py /opt/FreeDMR/proxy_db.py - -sudo chmod +x /opt/FreeDMR/*.py -sudo chmod +x /opt/FreeDMR/config/*.py -sh /opt/extra-1.sh - -sudo systemctl daemon-reload -sudo systemctl start proxy.service -sudo systemctl start freedmr.service -sudo systemctl start fdmrparrot.service -sudo systemctl restart fdmr_mon.service -###### - - -EOF -######################################### FDMR-Monitor Update ############################################################### -sudo cat > /opt/monitor-update.sh <<- "EOFB1" -#!/bin/bash -variable1=$(grep "REPORT_NAME =" /opt/FDMR-Monitor/fdmr-mon.cfg) -variable2=$(grep "THEME_COLOR =" /opt/FDMR-Monitor/fdmr-mon.cfg) -variable3=$(grep "COLOR_TEXT =" /opt/FDMR-Monitor/fdmr-mon.cfg) -variable4=$(grep "COLOR_1 =" /opt/FDMR-Monitor/fdmr-mon.cfg) -variable5=$(grep "COLOR_2 =" /opt/FDMR-Monitor/fdmr-mon.cfg) - -sudo systemctl stop fdmr_mon.service -sudo systemctl stop proxy.service - -if [ -d "/var/www/fdmr" ]; -then - rm -r /var/www/fdmr/ - #echo "found file" -else - echo "file not found" - -fi -if [ -d "/opt/FDMR-Monitor" ] -then - rm -r /opt/FDMR-Monitor - #echo "found file" - -fi -## -#FDMR-Monitor -cd /opt -sudo git clone https://github.com/yuvelq/FDMR-Monitor.git -cd FDMR-Monitor -sudo git checkout Self_Service -sudo chmod +x install.sh - -sudo sed -i 's/RELOAD_TIME = 15/RELOAD_TIME = 1/' /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -sudo sed -i 's/FREQUENCY = 10/FREQUENCY = 120/' /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -sudo chmod 644 /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -sed '33 a ' -i /opt/FDMR-Monitor/html/sysinfo.php -#### -sudo sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/html/*.* -sudo sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/sysinfo/*.* -#### -sudo sed -i 's/localhost_2-day.png/localhost_1-day.png/' /opt/FDMR-Monitor/html/sysinfo.php -sudo sed -i "s/HBMonv2/FDMR-Monitor/g" /opt/FDMR-Monitor/sysinfo/*.sh -sudo chmod +x /opt/FDMR-Monitor/sysinfo/cpu.sh -sudo chmod +x /opt/FDMR-Monitor/sysinfo/graph.sh -sudo chmod +x /opt/FDMR-Monitor/sysinfo/rrd-db.sh - -sudo sed -i "s/root/emqte1/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -sudo sed -i "s/test/selfcare/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -sudo sed -i "s/PRIVATE_NETWORK = True/PRIVATE_NETWORK = False/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -#sudo sed -i "s/TGID_URL =/#TGID_URL =/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -#sed '63 a #TGID_URL = https://freedmr.cymru/talkgroups/talkgroup_ids_json.php' -i /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -#sed '64 a #TGID_URL = https://freedmr.cymru/talkgroups/talkgroup_ids_flags_json.php' -i /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg - -cd /opt/FDMR-Monitor/ -#sudo rm /opt/FDMR-Monitor/install.sh -################ -sudo apt-get install rrdtool -y -sudo sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/html/*.* -sudo sed -i "s/www\/html/www\/fdmr/g" /opt/FDMR-Monitor/sysinfo/*.* -# Install the required support programs -pip3 install -r requirements.txt -pip install pyopenssl --upgrade -cd /opt/FDMR-Monitor/ -cp /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg /opt/FDMR-Monitor/fdmr-mon.cfg -############################### -sudo sed -i "s/root/emqte1/g" /opt/FDMR-Monitor/proxy/hotspot_proxy_v2.py -sudo sed -i "s/test/selfcare/g" /opt/FDMR-Monitor/proxy/hotspot_proxy_v2.py -sudo sed -i "s/\/freedmr.cfg/\/config\/FreeDMR.cfg/g" /opt/FDMR-Monitor/proxy/hotspot_proxy_v2.py -sudo sed -i "s/test/selfcare/g" /opt/FDMR-Monitor/proxy/proxy_db.py -sudo sed -i "s/root/emqte1/g" /opt/FDMR-Monitor/proxy/proxy_db.py -sudo sed -i "s/root/emqte1/g" /opt/FDMR-Monitor/proxy/proxy.cfg -sudo sed -i "s/test/selfcare/g" /opt/FDMR-Monitor/proxy/proxy.cfg -################# -cp /opt/FDMR-Monitor/proxy/hotspot_proxy_v2.py /opt/FreeDMR/hotspot_proxy_v2.py -cp /opt/FDMR-Monitor/proxy/proxy.cfg /opt/FreeDMR/proxy.cfg -cp /opt/FDMR-Monitor/proxy/proxy_db.py /opt/FreeDMR/proxy_db.py - -wget https://www.freedmr.uk/wp-content/uploads/2021/04/favicon.ico -O /opt/FDMR-Monitor/html/favicon.ico -sed '6 a ' -i /opt/FDMR-Monitor/html/index.php -wget https://www.freedmr.uk/wp-content/uploads/2021/04/Free_DMR_logo_250x141_72.png -O /opt/FDMR-Monitor/html/img/logo.png - -# -sudo cat > /opt/FDMR-Monitor/html/buttons.php <<- "EOF" - -Home - -