mirror of https://gitlab.com/hp3icc/emq-TE1.git
update
This commit is contained in:
parent
70103cd62e
commit
53e7e9c225
|
|
@ -0,0 +1,144 @@
|
|||
#!/bin/bash
|
||||
if [ -d "/opt/DVReflectors" ]
|
||||
then
|
||||
sudo rm -r /opt/DVReflectors
|
||||
fi
|
||||
if [ -d "/opt/P25Reflector" ]
|
||||
then
|
||||
sudo rm -r /opt/P25Reflector
|
||||
fi
|
||||
if [ -d "/var/log/p25reflector" ]
|
||||
then
|
||||
sudo rm -rf /var/log/p25reflector
|
||||
fi
|
||||
mkdir /var/log/p25reflector
|
||||
sudo chmod 777 /var/log/p25reflector
|
||||
cd /opt
|
||||
git clone https://github.com/nostar/DVReflectors.git
|
||||
mv /opt/DVReflectors/P25Reflector /opt/
|
||||
cd /opt/P25Reflector/
|
||||
make clean all
|
||||
sudo groupadd mmdvm
|
||||
sudo useradd mmdvm -g mmdvm -s /sbin/nologin
|
||||
sudo chmod +x *
|
||||
sudo rm -r /opt/DVReflectors
|
||||
#cp P25Reflector.sh /usr/local/bin/P25Reflector.sh
|
||||
#sudo chmod +x /usr/local/bin/P25Reflector.sh
|
||||
#sudo sed -i "s/PROG_ARGS=.*/PROG_ARGS=\"\/opt\/P25Reflector\/P25Reflector.ini\"/g" /usr/local/bin/P25Reflector.sh
|
||||
#sudo sed -i "s/FilePath=.*/FilePath=\/var\/log\/p25reflector/g" /opt/P25Reflector/P25Reflector.ini
|
||||
#sudo sed -i "s/Name=.*/Name=\/opt\/data-files\/DMRIds.dat/g" /opt/P25Reflector/P25Reflector.ini
|
||||
#sudo sed -i "s/Daemon=.*/Daemon=0/g" /opt/P25Reflector/P25Reflector.ini
|
||||
|
||||
sudo cat > /opt/P25Reflector/P25Reflector.ini <<- "EOF"
|
||||
[General]
|
||||
Daemon=0
|
||||
|
||||
[Info]
|
||||
Name= P25Reflector
|
||||
# 14 characters max
|
||||
Description= Reflector_description
|
||||
Contact=
|
||||
Web=
|
||||
|
||||
[Id Lookup]
|
||||
Name=/opt/data-files/DMRIds.dat
|
||||
Time=24
|
||||
|
||||
[Log]
|
||||
# Logging levels, 0=No logging
|
||||
DisplayLevel=1
|
||||
FileLevel=1
|
||||
FilePath=/var/log/p25reflector
|
||||
FileRoot=P25Reflector
|
||||
FileRotate=1
|
||||
|
||||
[Network]
|
||||
Port=41000
|
||||
Debug=0
|
||||
|
||||
EOF
|
||||
|
||||
#/usr/local/bin/P25Reflector.sh stop
|
||||
sudo cat > /lib/systemd/system/P25Reflector.service <<- "EOF"
|
||||
[Unit]
|
||||
Description=P25 Reflector Service
|
||||
# Description=Place this file in /lib/systemd/system
|
||||
# Description=N4IRS 01/25/2021
|
||||
|
||||
#After=netcheck.service
|
||||
#Requires=netcheck.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartPreventExitStatus=SEGV
|
||||
RestartSec=3
|
||||
StandardOutput=null
|
||||
WorkingDirectory=/opt/P25Reflector
|
||||
#ExecStartPre = /bin/sh -c 'echo "Starting P25Reflector: [`date +%%T.%%3N`]" >> /var/log/netcheck'
|
||||
ExecStart=/opt/P25Reflector/P25Reflector /opt/P25Reflector/P25Reflector.ini
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillMode=process
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
EOF
|
||||
|
||||
#################################################################################################################################
|
||||
# MMDVMHost - Dashboard WebSocket
|
||||
#################################################################################################################################
|
||||
#web
|
||||
if [ -f "/opt/wdp6" ]
|
||||
then
|
||||
echo "found file"
|
||||
else
|
||||
sudo cat > /opt/wdp6 <<- "EOFX"
|
||||
##############################################
|
||||
# Select number port, P25Reflector Dashboard #
|
||||
##############################################
|
||||
|
||||
Web-Dashboar-Port: 80
|
||||
|
||||
EOFX
|
||||
fi
|
||||
if [ -d "/opt/p25reflector-dashboard" ]
|
||||
then
|
||||
sudo rm -r /opt/p25reflector-dashboard
|
||||
fi
|
||||
cd /opt
|
||||
git clone https://gitlab.com/hp3icc/p25reflector-dashboard.git /opt/p25reflector-dashboard
|
||||
#!/bin/bash
|
||||
|
||||
# Obtener la zona horaria del sistema
|
||||
timezone=$(timedatectl show --property=Timezone --value)
|
||||
|
||||
# Escapar las barras invertidas en la zona horaria
|
||||
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
|
||||
|
||||
#echo "La zona horaria se ha actualizado a $timezone en el archivo de configuración."
|
||||
sudo sed -i "s/define(\"P25REFLECTORLOGPATH.*/define(\"P25REFLECTORLOGPATH\", \"\/var\/log\/p25reflector\");/g" /opt/p25reflector-dashboard/config/config.php
|
||||
#
|
||||
sudo cat > /lib/systemd/system/http.server-p25.service <<- "EOF"
|
||||
[Unit]
|
||||
Description=PHP http.server.p25
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
#ExecStartPre=/bin/sleep 30
|
||||
# Modify for different other port
|
||||
ExecStart=php -S 0.0.0.0:80 -t /opt/p25reflector-dashboard
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
|
||||
EOF
|
||||
#
|
||||
systemctl daemon-reload
|
||||
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
#!/bin/bash
|
||||
if [ -f "/opt/wdp6" ]
|
||||
then
|
||||
echo "found file"
|
||||
else
|
||||
sudo cat > /opt/wdp6 <<- "EOFX"
|
||||
##############################################
|
||||
# Select number port, P25Reflector Dashboard #
|
||||
##############################################
|
||||
|
||||
Web-Dashboar-Port: 80
|
||||
|
||||
EOFX
|
||||
fi
|
||||
sudo cat > /bin/menu-p25r <<- "EOF"
|
||||
#!/bin/bash
|
||||
while : ; do
|
||||
choix=$(whiptail --title "Raspbian Proyect HP3ICC Menu P25Reflector" --menu "Suba o Baje con las flechas del teclado y seleccione el numero de opcion" 20 50 11 \
|
||||
1 " Editar P25FReflector Server " \
|
||||
2 " Iniciar Reflector " \
|
||||
3 " Detener Reflector " \
|
||||
4 " Dashboard on " \
|
||||
5 " Dashboard off " \
|
||||
6 " Editar Puerto http " \
|
||||
7 " Editar HTML " \
|
||||
8 " 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/P25Reflector/P25Reflector.ini ;;
|
||||
2)
|
||||
sudo systemctl stop P25Reflector.service && sudo systemctl start P25Reflector.service && sudo systemctl enable P25Reflector.service ;;
|
||||
3)
|
||||
sudo systemctl stop P25Reflector.service && sudo systemctl disable P25Reflector.service ;;
|
||||
4)
|
||||
if sudo systemctl status http.server-p25.service |grep "service; enabled;" >/dev/null 2>&1
|
||||
then
|
||||
sudo systemctl disable http.server-p25.service
|
||||
fi
|
||||
if sudo systemctl status http.server-p25.service |grep active >/dev/null 2>&1
|
||||
then
|
||||
sudo systemctl stop http.server-p25.service
|
||||
fi
|
||||
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp6 | grep -Eo '[A.0-9]{1,9}')
|
||||
if [ -z "$variable80" ]
|
||||
then variable80=80
|
||||
|
||||
fi
|
||||
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/opt\/p25reflector-dashboard/g" /lib/systemd/system/http.server-p25.service &&
|
||||
systemctl daemon-reload &&
|
||||
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80 "; then
|
||||
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
|
||||
else
|
||||
if ! sudo systemctl status http.server-p25.service |grep "service; enabled;" >/dev/null 2>&1
|
||||
then
|
||||
sudo systemctl enable http.server-p25.service
|
||||
fi
|
||||
sudo systemctl start http.server-p25.service
|
||||
fi ;;
|
||||
5)
|
||||
sudo systemctl stop http.server-p25.service && sudo systemctl disable http.server-p25.service ;;
|
||||
6)
|
||||
if sudo systemctl status http.server-p25.service |grep active >/dev/null 2>&1
|
||||
then
|
||||
sudo systemctl stop http.server-p25.service
|
||||
fi
|
||||
sudo nano /opt/wdp6 &&
|
||||
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp6 | grep -Eo '[A.0-9]{1,9}')
|
||||
if [ -z "$variable80" ]
|
||||
then variable80=80
|
||||
|
||||
fi
|
||||
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/opt\/p25reflector-dashboard/g" /lib/systemd/system/http.server-p25.service &&
|
||||
systemctl daemon-reload &&
|
||||
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80 "; then
|
||||
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
|
||||
else
|
||||
if sudo systemctl status http.server-p25.service |grep "service; enabled;" >/dev/null 2>&1
|
||||
then
|
||||
sudo systemctl start http.server-p25.service
|
||||
fi
|
||||
fi ;;
|
||||
7)
|
||||
sudo nano /opt/p25reflector-dashboard/index.php ;;
|
||||
8)
|
||||
break;
|
||||
esac
|
||||
done
|
||||
exit 0
|
||||
EOF
|
||||
#########
|
||||
chmod +x /bin/menu-p25r
|
||||
ln -sf /bin/menu-p25r /bin/MENU-P25R
|
||||
chmod +x /bin/MENU*
|
||||
Loading…
Reference in New Issue