From 45f9f3f3c367da6c1439732a5062eee4afc164f1 Mon Sep 17 00:00:00 2001 From: Esteban Mackay Q Date: Sat, 14 Oct 2023 22:40:15 -0500 Subject: [PATCH] update --- easy-fdmr.sh | 1 + fdmr-bridge.sh | 619 +++++++++++++++++++++++++++++++++++++++++++++++++ update-b.sh | 10 + 3 files changed, 630 insertions(+) create mode 100644 fdmr-bridge.sh create mode 100644 update-b.sh diff --git a/easy-fdmr.sh b/easy-fdmr.sh index fd1c010..ff922b8 100644 --- a/easy-fdmr.sh +++ b/easy-fdmr.sh @@ -79,6 +79,7 @@ rustup default 1.72.0 /usr/bin/python3 -m pip install --upgrade setproctitle /usr/bin/python3 -m pip install --upgrade pynmea2 /usr/bin/python3 -m pip install --upgrade spyne +/usr/bin/python3 -m pip install --upgrade Pyro5 echo "Instalación completa." diff --git a/fdmr-bridge.sh b/fdmr-bridge.sh new file mode 100644 index 0000000..6b2461b --- /dev/null +++ b/fdmr-bridge.sh @@ -0,0 +1,619 @@ + +cd /opt/ +if [ -f "/opt/FreeDMR-Bridge/config/FreeDMR.cfg" ]; +then + variable=$(grep "SERVER_ID:" /opt/FreeDMR-Bridge/config/FreeDMR.cfg | grep -Eo '[0-9]{1,9}') + else + echo "id not found" + +fi +if [ -z "$variable" ] +then variable=00000 + +fi +if [ -d "/opt/FreeDMR-Bridge" ] +then + sudo rm -r /opt/FreeDMR-Bridge +fi +if [ ! -d "/var/log/FreeDMR-B" ] +then + mkdir -p /var/log/FreeDMR-B +fi +git clone https://gitlab.hacknix.net/hacknix/FreeDMR.git /opt/FreeDMR-Bridge +mkdir /opt/FreeDMR-Bridge/config +sudo chmod +x /opt/FreeDMR-Bridge/* +cp /opt/FreeDMR-Bridge/rules_SAMPLE.py /opt/FreeDMR-Bridge/config/rules.py +if [ "$(cat /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg | grep 'TOPO_FILE')" != "" ]; then +sed -i 's/TOPO_FILE:.*/TOPO_FILE: topography.json/' /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +else +sed '45 a TOPO_FILE: topography.json' -i /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +fi +sed -i "s/ANNOUNCEMENT_LANGUAGE:.*/ANNOUNCEMENT_LANGUAGE: es_ES/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/SINGLE_MODE:.*/SINGLE_MODE: False/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/VOICE_IDENT:.*/VOICE_IDENT: False/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/VALIDATE_SERVER_IDS:.*/VALIDATE_SERVER_IDS: False/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/ALLOW_UNREG_ID:.*/ALLOW_UNREG_ID: True/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/PROXY_CONTROL:.*/PROXY_CONTROL: False/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/54000/57000/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +#sed -i "s/TRY_DOWNLOAD:.*/TRY_DOWNLOAD: False/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +#sed -i "s/ENABLED:.*/ENABLED: False/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i 's/file-timed/console-timed/' /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i 's/INFO/DEBUG/' /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i 's/freedmr.log/\/var\/log\/FreeDMR-B\/FreeDMR.log/' /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/SERVER_ID:.*/SERVER_ID: $variable/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/4321/4382/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/CHECKSUM_URL:.*/CHECKSUM_URL:/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/CHECKSUM_FILE:.*/CHECKSUM_FILE:/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/SUBSCRIBER_FILE:.*/SUBSCRIBER_FILE: user.json/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/SUBSCRIBER_URL:.*/SUBSCRIBER_URL: http:\/\/datafiles.ddns.net:8888\/user.json/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/TGID_URL:.*/TGID_URL: http:\/\/datafiles.ddns.net:8888\/talkgroup_ids.json/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/PEER_FILE:.*/PEER_FILE: rptrs.json/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg +sed -i "s/EER_URL:.*/PEER_URL: https:\/\/database.radioid.net\/static\/rptrs.json/g" /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg + +cp /opt/FreeDMR-Bridge/FreeDMR-SAMPLE.cfg /opt/FreeDMR-Bridge/config/FreeDMR.cfg +sudo cat > /opt/FreeDMR-Bridge/proxy.cfg <<- "EOF" +[PROXY] +MASTER = 127.0.0.1 +LISTENPORT = 62031 +# Leave blank for IPv4, :: = all IPv4 and IPv6 (Dual Stack) +LISTENIP = +DESTPORTSTART = 57000 +DESTPORTEND = 57100 +TIMEOUT = 30 +STATS = False +DEBUG = False +CLIENTINFO = False +BLACKLIST = [1234567,1231237,123123701] +#e.g. {10.0.0.1: 0, 10.0.0.2: 0} +IPBLACKLIST = {} + +[SELF SERVICE] +USE_SELFSERVICE = True +SERVER = 127.0.0.1 +USERNAME = hbmon +# For no password leave it blank +PASSWORD = hbmon +DB_NAME = hbmon +PORT = 3306 + +EOF +sudo cat > /lib/systemd/system/freedmr-bridge.service <<- "EOF" +[Unit] +Description=FreeDmr-Bridge +After=multi-user.target + +[Service] +#User=root +#Type=simple +#Restart=always +#RestartSec=3 +#StandardOutput=null +ExecStart=/usr/bin/python3 /opt/FreeDMR-Bridge/bridge.py -c /opt/FreeDMR-Bridge/config/FreeDMR.cfg -r /opt/FreeDMR-Bridge/config/rules.py +Restart=on-failure + +[Install] +WantedBy=multi-user.target + +EOF +### +systemctl daemon-reload + +############################################################################################## +#FDMR-Monitor +if [ ! -d "/var/www" ] +then + mkdir -p /var/www +fi +if [ -d "/var/www/fdmr-b" ] +then + rm -r /var/www/fdmr-b +fi +if [ -d "/opt/FDMR-Monitor-B" ] +then + rm -r /opt/FDMR-Monitor-B +fi +mkdir /var/www/fdmr-b +cd /opt +sudo git clone https://github.com/yuvelq/FDMR-Monitor.git /opt/FDMR-Monitor-B +cd /opt/FDMR-Monitor-B +sudo chmod +x install.sh +chmod 755 /opt/FDMR-Monitor-B/data +sed -i "s/4321/4382/g" /opt/FDMR-Monitor-B/fdmr-mon_SAMPLE.cfg +find /opt/FDMR-Monitor-B -type f -exec sed -i 's/9000/9200/g' {} + +sed -i 's/RELOAD_TIME =.*/RELOAD_TIME = 1/' /opt/FDMR-Monitor-B/fdmr-mon_SAMPLE.cfg +sed -i 's/FREQUENCY =.*/FREQUENCY = 1/' /opt/FDMR-Monitor-B/fdmr-mon_SAMPLE.cfg +sudo chmod 644 /opt/FDMR-Monitor-B/fdmr-mon_SAMPLE.cfg +sed '33 a ' -i /opt/FDMR-Monitor-B/html/sysinfo.php +#### +sed -i "s/www\/html/www\/fdmr-b/g" /opt/FDMR-Monitor-B/html/*.* +sed -i "s/www\/html/www\/fdmr-b/g" /opt/FDMR-Monitor-B/sysinfo/*.* +sed -i "s/1100/1200/g" /opt/FDMR-Monitor-B/html/*.* +sed -i "s/1100/1200/g" /opt/FDMR-Monitor-B/html/css/*.* +sed -i "s/1100/1200/g" /opt/FDMR-Monitor-B/templates/*.* +sed -i 's/b1eee9/3bb43d/' /opt/FDMR-Monitor-B/html/css/*.* +#### +sed -i 's/localhost_2-day.png/localhost_1-day.png/' /opt/FDMR-Monitor-B/html/sysinfo.php +sed -i "s/HBMonv2/FDMR-Monitor/g" /opt/FDMR-Monitor-B/sysinfo/*.sh +sudo chmod +x /opt/FDMR-Monitor-B/sysinfo/cpu.sh +sudo chmod +x /opt/FDMR-Monitor-B/sysinfo/graph.sh +sudo chmod +x /opt/FDMR-Monitor-B/sysinfo/rrd-db.sh + +#sudo rm /opt/FDMR-Monitor-B/install.sh +################ +apps=("rrdtool") + +for app in "${apps[@]}" +do + # Verificar apps + if ! dpkg -s "$app" >/dev/null 2>&1; then + # app no instalada + sudo apt-get install -y "$app" + else + # app ya instalada + echo "$app ya instalada" + fi +done +sed -i "s/www\/html/www\/fdmr-b/g" /opt/FDMR-Monitor-B/html/*.* +sed -i "s/www\/html/www\/fdmr-b/g" /opt/FDMR-Monitor-B/sysinfo/*.* +# Install the required support programs +#sudo pip install -U -r requirements.txt +cp /opt/FDMR-Monitor-B/fdmr-mon_SAMPLE.cfg /opt/FDMR-Monitor-B/fdmr-mon.cfg +############################### +sed -i "s/PEER_URL =.*/PEER_URL = https:\/\/freedmr-lh.gb7fr.org.uk\/json\/peer_ids.json/g" /opt/FDMR-Monitor-B/fdmr-mon.cfg +sed -i "s/SUBSCRIBER_URL =.*/SUBSCRIBER_URL = http:\/\/datafiles.ddns.net:8888\/user.json/g" /opt/FDMR-Monitor-B/fdmr-mon.cfg +sed -i "s/SUBSCRIBER_FILE =.*/SUBSCRIBER_FILE = subscriber_ids.json/g" /opt/FDMR-Monitor-B/fdmr-mon.cfg +sed -i "s/TGID_URL =.*/TGID_URL = http:\/\/datafiles.ddns.net:8888\/talkgroup_ids.json/g" /opt/FDMR-Monitor-B/fdmr-mon.cfg +################# + +wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1B-M7QNdf1gLVzbTn-Fi5GVPy6GTXcxJ-' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1B-M7QNdf1gLVzbTn-Fi5GVPy6GTXcxJ-" -O /opt/FDMR-Monitor-B/html/favicon.ico && rm -rf /tmp/cookies.txt && + +sed '6 a ' -i /opt/FDMR-Monitor-B/html/index.php +wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1evvxLOh8uxKYYLoV0aORjDhFeLF42_S_' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1evvxLOh8uxKYYLoV0aORjDhFeLF42_S_" -O /opt/FDMR-Monitor-B/html/img/logo.png && rm -rf /tmp/cookies.txt && + + +# +sudo cat > /opt/FDMR-Monitor-B/html/buttons.php <<- "EOF" + +Home +  + + + + + + + + +EOF + +# +sudo cat > /opt/FDMR-Monitor-B/templates/main_table.html <<- "EOF" + +
+ .: Server Activity :.  +{% if _table['MASTERS']|length >0 %} + + + + + + + {% for _master in _table['MASTERS'] %} + {% for _client, _cdata in _table['MASTERS'][_master]['PEERS'].items() %} + {% if _cdata[1]['TS'] == True or _cdata[2]['TS'] == True %} + + {% if _cdata[1]['TRX'] == "RX" %} + + + + {% endif %} + {% if _cdata[2]['TRX'] == "RX" %} + + + + {% endif %} + + {% endif %} + {% endfor %} + {% endfor %} + +{% else %} +
Systems M&PSourceDestination
M: {{_master}} {{ _cdata[1]['SUB']|safe }} [TS {{ 1 if _cdata[1]['TS'] == True else 2 }}]{{ _cdata[1]['DEST']|safe }}M: {{_master}} {{ _cdata[2]['SUB']|safe }} [TS {{ 1 if _cdata[1]['TS'] == True else 2 }}]{{ _cdata[2]['DEST']|safe }}
+ + + +
Waiting for Data from FreeDMR Server ...
+ {% endif %} + {% for _peer, _pdata in _table['PEERS'].items() %} + {% if _pdata[1]['TS'] == True or _pdata[2]['TS'] == True %} + + {% if _pdata[1]['TRX'] == "RX" %} + P: {{_peer}} + {{ _pdata[1]['SUB']|safe }} [TS {{ 1 if _pdata[1]['TS'] == True else 2 }}] + {{ _cdata[1]['DEST']|safe }} + {% endif %} + {% if _pdata[2]['TRX'] == "RX" %} + P: {{_peer}} + {{ _pdata[2]['SUB']|safe }} [TS {{ 1 if _pdata[1]['TS'] == True else 2 }}] + {{ _pdata[2]['DEST']|safe }} + {% endif %} + + {% endif %} + {% endfor %} +
+ +{% if _table['OPENBRIDGES']|length >0 %} + + Systems OpenBridge + Active Incoming Calls + + {% for _openbridge in _table['OPENBRIDGES'] %} + {% set rx = namespace(value=0) %} + {% if _table['OPENBRIDGES'][_openbridge]['STREAMS']|length >0 %} + {% for entry in _table['OPENBRIDGES'][_openbridge]['STREAMS'] if _table['OPENBRIDGES'][_openbridge]['STREAMS'][entry][0]=='RX' %} + {% set rx.value=1 %} + {% endfor %} + {% if rx.value == 1 %} + + {{ _openbridge}} + + {% for entry in _table['OPENBRIDGES'][_openbridge]['STREAMS'] if _table['OPENBRIDGES'][_openbridge]['STREAMS'][entry][0] == 'RX' %}[{{ _table['OPENBRIDGES'][_openbridge]['STREAMS'][entry][0] }}: {{ _table['OPENBRIDGES'][_openbridge]['STREAMS'][entry][1] }} >> {{ _table['OPENBRIDGES'][_openbridge]['STREAMS'][entry][2] }}]  {% endfor %} + + + {% endif %} + {% endif %} + {% endfor %} +{% endif %} + +
+ + + + + + +{% if _table['SETUP']['LASTHEARD'] == True %} +
+ .: Lastheard :. + + + + + + + + + + + + {% for itm in lastheard %} + + + + {% if not itm[7] %} + + + {% else %} + + + {% endif %} + + + + + + {% endfor %} +
DateTimeCallsign (DMR-Id)NameTG#TG NameTX (s)System
{{ itm[0][:10] }}{{ itm[0][11:] }}{{ itm[6] }}{{ itm[7][0] }} ({{ itm[6] }}){{ itm[7][1] }}{{ itm[4] }}{{ '' if not itm[5] else itm[5]|safe }}{{ 'DATA' if not itm[1] else itm[1]|int }}{{ itm[3] }}
+
+{% endif %} + +
+ .: Connected to Server :. +
+{% if _table['MASTERS']|length >0 %} + +
+
  LINKS:
+
+ {% for _master in _table['MASTERS'] %} + {% if _table['MASTERS'][_master]['PEERS']|length >0 %} + {% for _client, _cdata in _table['MASTERS'][_master]['PEERS'].items() %} + + {{_cdata['CALLSIGN']}} + + +    DMR ID: {{ _client }}
+ {% if _cdata['RX_FREQ'] == 'N/A' and _cdata['TX_FREQ'] == 'N/A' %} +    Type: IP Network
+ {% else %} +    Type: Radio ({{ _cdata['SLOTS'] }})
+ {% endif %} +    Hardware: {{_cdata['PACKAGE_ID'] }} +
   Soft_Ver: {{_cdata['SOFTWARE_ID'] }} +
   Info: {{_cdata['LOCATION']}} +
   Master: {{_master}} +
  + {% endfor %} + {% endif %} + {% endfor %} +
+{% endif %} + + {% if _table['PEERS']|length >0 %} +

PEERS:

+
+ {% for _peer, _pdata in _table['PEERS'].items() %} +
  {{_peer}}   + {% if _table['PEERS'][_peer]['STATS']['CONNECTION'] == 'YES' %} + Connected + {% else %} + Disconnected + {% endif %} +
+ {% endfor %} +
+ {% endif %} +
+
+ + +EOF +# +sed -i "s/1100/1200/g" /opt/FDMR-Monitor-B/templates/*.* +sed -i "s/Copyright (c) 2016-.*/Copyright (c) \"2016\") {\$cdate=\"2016-\".date(\"Y\");} echo \$cdate; ?>
/g" /opt/FDMR-Monitor-B/html/*.php +sed -i "s/meta name=\"description.*/meta name=\"description\" content=\"Copyright (c) 2016-22.The Regents of the K0USY Group. All rights reserved. Version OA4DOA 2022 (v270422)\">/g" /opt/FDMR-Monitor-B/html/*.php +sed -i 's/b1eee9/3bb43d/' /opt/FDMR-Monitor-B/html/css/*.* +sed -i "s/All rights reserved.
.*/All rights reserved.
\"2018\") {\$cdate=\"2018-\".date(\"Y\");} echo \$cdate; ?>\" target=\"_blank\" href=https:\/\/gitlab.com\/hp3icc\/fdmr-b\/>Proyect: FDMR Bridge<\/a>
/g" /opt/FDMR-Monitor-B/html/*.php +sed -i '166 s/hotpink/#ad02fd/g' /opt/FDMR-Monitor-B/html/css/styles.php +sed -i '217 s/color:white/color:black/' /opt/FDMR-Monitor-B/html/css/styles.php +# + +if [ -f "mon.db" ] +then + rm mon.db +fi + +cd /opt/FDMR-Monitor-B +python3 mon_db.py --create +python3 mon_db.py --update +cp -r /opt/FDMR-Monitor-B/html/* /var/www/fdmr-b/ +sudo chown www-data:www-data /var/www/fdmr-b/ -R +sed -i "s/opt\/FDMR-Monitor/opt\/FDMR-Monitor-B/g" /opt/FDMR-Monitor-B/utils/logrotate/fdmr_mon +mv /opt/FDMR-Monitor-B/utils/logrotate/fdmr_mon /etc/logrotate.d/fdmr_mon-b +systemctl stop apache2 +systemctl disable apache2 +##################### +chmod +x /opt/FDMR-Monitor-B/sysinfo/* +sh /opt/FDMR-Monitor-B/sysinfo/rrd-db.sh +(crontab -l; echo "*/5 * * * * sh /opt/FDMR-Monitor-B/sysinfo/graph.sh")|awk '!x[$0]++'|crontab - +(crontab -l; echo "*/2 * * * * sh /opt/FDMR-Monitor-B/sysinfo/cpu.sh")|awk '!x[$0]++'|crontab - +################## +#Service +########## +sudo cat > /lib/systemd/system/http.server-fdmr-b.service <<- "EOF" +[Unit] +Description=PHP http.server.fdmr +After=network.target + +[Service] +#User=root +#ExecStartPre=/bin/sleep 30 +# Modify for different other port +ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr-b/ +Restart=on-failure + +[Install] +WantedBy=multi-user.target + +EOF +# +sudo cat > /lib/systemd/system/proxy2.service <<- "EOF" +[Unit] +Description= Proxy Service Bridge +After=multi-user.target + +[Service] +#User=root +#Type=simple +#Restart=always +#RestartSec=3 +#StandardOutput=null +ExecStart=/usr/bin/python3 /opt/FDMR-Monitor-B/hotspot_proxy_v2.py -c /opt/FDMR-Monitor-B/proxy.cfg +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOF +sudo cat > /lib/systemd/system/fdmr_mon-b.service <<- "EOF" +[Unit] +Description=FDMR Monitor +# To make the network-online.target available +# systemctl enable systemd-networkd-wait-online.service +#After=network-online.target syslog.target +#Wants=network-online.target + +[Service] +#User=root +#Type=simple +#Restart=always +#RestartSec=3 +#StandardOutput=null +WorkingDirectory=/opt/FDMR-Monitor-B +ExecStart=python3 /opt/FDMR-Monitor-B/monitor.py +#Restart=on-abort +Restart=on-failure + + +[Install] +WantedBy=multi-user.target + +EOF +# +bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-fdmr)" +### +chmod +x /bin/menu-fdmr +ln -sf /bin/menu-fdmr /bin/MENU-FDMR +sh /opt/extra-1.sh +sh /opt/extra-2.sh +#################################################################### +#monitor2 +if [ ! -d "/var/www" ] +then + mkdir -p /var/www +fi +if [ -d "/var/www/fdmr-b2" ] +then + rm -r /var/www/fdmr-b2 +fi +if [ -d "/opt/FDMR-Monitor-B2" ] +then + rm -r /opt/FDMR-Monitor-B2 +fi +mkdir /var/www/fdmr-b2 +if [ -f "/opt/wdp7" ] +then + echo "found file" +else +sudo cat > /opt/wdp7 <<- "EOFX" +######################################### +# Select number port, FreeDMR Dashboard # +######################################### + +Web-Dashboar-Port: 80 + +EOFX +fi + +cd /opt +sudo git clone https://github.com/CS8ABG/FDMR-Monitor.git /opt/FDMR-Monitor-B2 +cd /opt/FDMR-Monitor-B2 +#sudo pip install -U -r requirements.txt +chmod 755 /opt/FDMR-Monitor-B2/data + +#sed -i '72d' /opt/FDMR-Monitor-B2/html/include/navbar.php +#sed '69 a \ ' -i /opt/FDMR-Monitor-B2/html/include/navbar.php +sudo chmod 644 /opt/FDMR-Monitor-B/fdmr-mon_SAMPLE.cfg +find /opt/FDMR-Monitor-B2 -type f -exec sed -i 's/9000/9200/g' {} + +sed -i "s/4321/4382/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i 's/RELOAD_TIME =.*/RELOAD_TIME = 1/' /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i 's/FREQUENCY =.*/FREQUENCY = 1/' /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/LANGUAGE =.*/LANGUAGE = \"es\"/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/TELEGRAM/#TELEGRAM/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/configFile =.*/configFile = '\/opt\/FDMR-Monitor-B2\/fdmr-mon.cfg';/g" /opt/FDMR-Monitor-B2/html/config.php +sed -i "s/PRIVATE_NETWORK = True/PRIVATE_NETWORK = False/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/CS8ABG<\/a> Dash/FDMR-Monitor2<\/a> by
CS8ABG<\/a> , Proyect: FDMR Bridge<\/a>/g" /opt/FDMR-Monitor-B2/html/include/footer.php +sed -i "s/SUBSCRIBER_FILE =.*/SUBSCRIBER_FILE = subscriber_ids.json/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/SUBSCRIBER_URL =.*/SUBSCRIBER_URL = http:\/\/datafiles.ddns.net:8888\/user.json/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/TGID_URL =.*/TGID_URL = http:\/\/datafiles.ddns.net:8888\/talkgroup_ids.json/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/FILES_PATH =.*/FILES_PATH = \/opt\/FDMR-Monitor2\/data/g" /opt/FDMR-Monitor-B2/fdmr-mon_SAMPLE.cfg +sed -i "s/#fff/#d1d1d1/g" /opt/FDMR-Monitor-B2/html/plugins/adminlte/css/adminlte.min.css +sed -i "s/f8f9fa/d0d0d0/g" /opt/FDMR-Monitor-B2/html/plugins/adminlte/css/adminlte.min.css +sed -i "s/configFile =.*/configFile = '\/opt\/FDMR-Monitor-B2\/fdmr-mon.cfg';/g" /opt/FDMR-Monitor-B2/html/ssconfunc.php +#sed -i "s/configFile =.*/configFile = '\/opt\/FDMR-Monitor2\/fdmr-mon.cfg';/g" /var/www/fdmr2/ssconfunc.php + +wget -q --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=1cWqClH0FUxV5d-rVnibI_-iCypFnTDb3' -O /opt/FDMR-Monitor-B2/html/img/bk.jpg && +wget -q --no-check-certificate -r 'https://docs.google.com/uc?export=download&id=1vsviKjpZmL_mWVEW2UstNODGPl8-uNVo' -O /opt/flags.zip && + +sudo unzip -o /opt/flags.zip -d /opt/FDMR-Monitor-B2/html/flags/ && +rm /opt/flags.zip + +cp fdmr-mon_SAMPLE.cfg fdmr-mon.cfg +sudo chmod 644 fdmr-mon.cfg +sudo cp /opt/FDMR-Monitor-B2/html/* /var/www/fdmr2/ -r + +#***** +mv /opt/FDMR-Monitor-B2/utils/logrotate/fdmr_mon /opt/FDMR-Monitor-B2/utils/logrotate/fdmr_mon2 +mv /opt/FDMR-Monitor-B2/utils/systemd/fdmr_mon.service /opt/FDMR-Monitor-B2/utils/systemd/fdmr_mon2.service +# \ +sed -i "s/\/.*/\/opt\/FDMR-Monitor-B2\/log\/fdmr-mon.log {/g" /opt/FDMR-Monitor-B2/utils/logrotate/fdmr_mon2 +sed -i "s/Description=.*/Description=FDMR Monitor-B2/g" /opt/FDMR-Monitor-B2/utils/systemd/fdmr_mon2.service +sed -i "s/WorkingDirectory=.*/WorkingDirectory=\/opt\/FDMR-Monitor-B2/g" /opt/FDMR-Monitor-B2/utils/systemd/fdmr_mon2.service +sed -i "s/ExecStart=.*/ExecStart=python3 \/opt\/FDMR-Monitor-B2\/monitor.py/g" /opt/FDMR-Monitor-B2/utils/systemd/fdmr_mon2.service +sudo cp /opt/FDMR-Monitor-B2/utils/logrotate/fdmr_mon2 /etc/logrotate.d/fdmr_mon-b2 +sudo cp /opt/FDMR-Monitor-B2/utils/systemd/fdmr_mon2.service /lib/systemd/system/fdmr_mon-b2.service +#sudo rm mon.db + +if [ -f "mon.db" ] +then + rm mon.db +fi + +cd /opt/FDMR-Monitor-B2 +cp -r /opt/FDMR-Monitor-B2/html/* /var/www/fdmr-b2/ +sudo chown www-data:www-data /var/www/fdmr-b2/ -R + +#python3 mon_db.py --create +#python3 mon_db.py --update + +sudo cat > /lib/systemd/system/http.server-fdmr-b2.service <<- "EOF" +[Unit] +Description=PHP http.server.fdmr-b2 +After=network.target + +[Service] +#User=root +#ExecStartPre=/bin/sleep 30 +# Modify for different other port +ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr-b2/ +Restart=on-failure + +[Install] +WantedBy=multi-user.target + +EOF +############################# +sudo systemctl daemon-reload + diff --git a/update-b.sh b/update-b.sh new file mode 100644 index 0000000..d2b4892 --- /dev/null +++ b/update-b.sh @@ -0,0 +1,10 @@ +#!/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 + +############## +whiptail --title "FreeDMR Bridge - Update" --msgbox "scrip sin actualizaciones disponibles / scrip no updates available" 0 50