mirror of https://gitlab.com/hp3icc/emq-TE1.git
786 lines
24 KiB
Bash
786 lines
24 KiB
Bash
#!/bin/bash
|
|
if ! grep -q "Web-Dashboar-name" "/opt/wdp6" > /dev/null 2>&1; then
|
|
sudo cat > /opt/wdp6 <<- "EOFX"
|
|
##############################################
|
|
# Select number port, P25Reflector Dashboard #
|
|
##############################################
|
|
|
|
Web-Dashboar-name: p25
|
|
Web-Dashboar-Port: 80
|
|
Web-Dashboar-dns:
|
|
Web-Dashboar-dir: /var/www/p25
|
|
|
|
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 12 \
|
|
1 " Editar P25FReflector Server " \
|
|
2 " Start-Restart Reflector " \
|
|
3 " Stop Reflector " \
|
|
4 " Dashboard on " \
|
|
5 " Dashboard off " \
|
|
6 " Edit Port http & dns " \
|
|
7 " enable setup.php " \
|
|
8 " remove setup.php " \
|
|
9 " UPDATE Host & DMRId " \
|
|
10 " P25Bbridge <> XLX/DMR " \
|
|
11 " 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)
|
|
sudo nano /etc/P25Reflector.ini ;;
|
|
2)
|
|
python3 /opt/data-mmdvm.py &&
|
|
servicios="P25Reflector.service"
|
|
|
|
# Primero, detener todos los servicios
|
|
for servicio in $servicios; do
|
|
if systemctl is-enabled "$servicio" &>/dev/null || systemctl is-active "$servicio" &>/dev/null; then
|
|
echo "Deteniendo $servicio"
|
|
sudo systemctl stop "$servicio"
|
|
fi
|
|
done
|
|
|
|
# Esperar un momento para asegurarse de que todos los servicios se detengan completamente
|
|
sleep 5
|
|
|
|
# Luego, iniciar todos los servicios
|
|
for servicio in $servicios; do
|
|
echo "Iniciando $servicio"
|
|
sudo systemctl start "$servicio"
|
|
sudo systemctl enable "$servicio" &>/dev/null
|
|
done
|
|
;;
|
|
3)
|
|
sudo systemctl stop P25Reflector.service && sudo systemctl disable P25Reflector.service ;;
|
|
4)
|
|
wdp=/opt/wdp6
|
|
wsn0=$(grep "Web-Dashboar-name:" $wdp | grep -oP 'Web-Dashboar-name:\s*\K.*')
|
|
if [ -f "/etc/nginx/sites-enabled/$wsn0" ]; then
|
|
rm /etc/nginx/sites-enabled/$wsn0
|
|
fi
|
|
if [ -f "/etc/nginx/sites-enabled/000" ]; then
|
|
rm /etc/nginx/sites-enabled/000
|
|
fi
|
|
sudo systemctl restart nginx
|
|
|
|
wd0p=$(grep "Web-Dashboar-Port:" $wdp | grep -oP 'Web-Dashboar-Port:\s*\K.*')
|
|
if [ -z "$wd0p" ]
|
|
then wd0p=80
|
|
|
|
fi
|
|
wsn0=$(grep "Web-Dashboar-name:" $wdp | grep -oP 'Web-Dashboar-name:\s*\K.*')
|
|
w0dn0=$(grep "Web-Dashboar-dns:" $wdp | grep -oP 'Web-Dashboar-dns:\s*\K.*')
|
|
w0d0=$(grep "Web-Dashboar-dir:" $wdp | grep -oP 'Web-Dashboar-dir:\s*\K.*')
|
|
if [ -z "$w0dn0" ]; then
|
|
if sudo netstat -tuln | grep -q "0.0.0.0:$wd0p "; then
|
|
whiptail --title "Check Port" --msgbox "El puerto $wd0p está ocupado. The port $wd0p is busy" 0 50
|
|
exit 0
|
|
else
|
|
echo ""
|
|
fi
|
|
fi
|
|
sudo ln -sf /etc/nginx/sites-available/000 /etc/nginx/sites-enabled/$wsn0
|
|
if [ ! -z "$w0dn0" ]; then
|
|
sudo sed -i '3i\ server_name w0dn0;' /etc/nginx/sites-enabled/$wsn0
|
|
fi
|
|
sed -i "s|wsn0|$wsn0|g" /etc/nginx/sites-enabled/$wsn0
|
|
sed -i "s|wd0p|$wd0p|g" /etc/nginx/sites-enabled/$wsn0
|
|
sed -i "s|w0dn0|$w0dn0|g" /etc/nginx/sites-enabled/$wsn0
|
|
sed -i "s|w0d0|$w0d0|g" /etc/nginx/sites-enabled/$wsn0
|
|
|
|
if [ -f "/etc/nginx/sites-enabled/000" ]; then
|
|
rm /etc/nginx/sites-enabled/000
|
|
fi
|
|
sudo systemctl restart nginx
|
|
;;
|
|
5)
|
|
wdp=/opt/wdp6
|
|
wsn0=$(grep "Web-Dashboar-name:" $wdp | grep -oP 'Web-Dashboar-name:\s*\K.*')
|
|
if [ -f "/etc/nginx/sites-enabled/$wsn0" ]; then
|
|
rm /etc/nginx/sites-enabled/$wsn0
|
|
fi
|
|
if [ -f "/etc/nginx/sites-enabled/000" ]; then
|
|
rm /etc/nginx/sites-enabled/000
|
|
fi
|
|
sudo systemctl restart nginx
|
|
;;
|
|
6)
|
|
wdp=/opt/wdp6
|
|
if [ -f "/tmp/w0dn0.txt" ]; then
|
|
rm /tmp/w0dn0.txt
|
|
fi
|
|
if [ -f "/tmp/wd0p.txt" ]; then
|
|
rm /tmp/wd0p.txt
|
|
fi
|
|
wsn0=$(grep "Web-Dashboar-name:" $wdp | grep -oP 'Web-Dashboar-name:\s*\K.*')
|
|
if [ -f "/etc/nginx/sites-enabled/$wsn0" ]; then
|
|
rm /etc/nginx/sites-enabled/$wsn0
|
|
fi
|
|
if [ -f "/etc/nginx/sites-enabled/000" ]; then
|
|
rm /etc/nginx/sites-enabled/000
|
|
fi
|
|
sudo systemctl restart nginx
|
|
|
|
whiptail --title "Setup Webserver" --inputbox "Select HTTP port:" 10 60 2>/tmp/wd0p.txt
|
|
exitstatus=$?
|
|
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
|
|
wd0p=$(cat /tmp/wd0p.txt)
|
|
|
|
whiptail --title "Setup Webserver" --inputbox "DNS name:" 10 60 2>/tmp/w0dn0.txt
|
|
exitstatus=$?
|
|
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
|
|
w0dn0=$(cat /tmp/w0dn0.txt)
|
|
|
|
sed -i "s|Web-Dashboar-Port:.*|Web-Dashboar-Port: $wd0p|g" $wdp
|
|
sed -i "s|Web-Dashboar-dns:.*|Web-Dashboar-dns: $w0dn0|g" $wdp
|
|
wd0p=$(grep "Web-Dashboar-Port:" $wdp | grep -oP 'Web-Dashboar-Port:\s*\K.*')
|
|
if [ -z "$wd0p" ]
|
|
then wd0p=80
|
|
|
|
fi
|
|
wsn0=$(grep "Web-Dashboar-name:" $wdp | grep -oP 'Web-Dashboar-name:\s*\K.*')
|
|
w0dn0=$(grep "Web-Dashboar-dns:" $wdp | grep -oP 'Web-Dashboar-dns:\s*\K.*')
|
|
w0d0=$(grep "Web-Dashboar-dir:" $wdp | grep -oP 'Web-Dashboar-dir:\s*\K.*')
|
|
if [ -z "$w0dn0" ]; then
|
|
if sudo netstat -tuln | grep -q "0.0.0.0:$wd0p "; then
|
|
whiptail --title "Check Port" --msgbox "El puerto $wd0p está ocupado. The port $wd0p is busy" 0 50
|
|
exit 0
|
|
else
|
|
echo ""
|
|
fi
|
|
fi
|
|
sudo ln -sf /etc/nginx/sites-available/000 /etc/nginx/sites-enabled/$wsn0
|
|
if [ ! -z "$w0dn0" ]; then
|
|
sudo sed -i '3i\ server_name w0dn0;' /etc/nginx/sites-enabled/$wsn0
|
|
fi
|
|
sed -i "s|wsn0|$wsn0|g" /etc/nginx/sites-enabled/$wsn0
|
|
sed -i "s|wd0p|$wd0p|g" /etc/nginx/sites-enabled/$wsn0
|
|
sed -i "s|w0dn0|$w0dn0|g" /etc/nginx/sites-enabled/$wsn0
|
|
sed -i "s|w0d0|$w0d0|g" /etc/nginx/sites-enabled/$wsn0
|
|
|
|
if [ -f "/etc/nginx/sites-enabled/000" ]; then
|
|
rm /etc/nginx/sites-enabled/000
|
|
fi
|
|
sudo systemctl restart nginx
|
|
;;
|
|
7)
|
|
cp /opt/P25Reflector-Dashboard/setup.php /var/www/p25/setup.php &&
|
|
whiptail --title "P25Reflector" --msgbox "setup.php is ready to use, refresh your browser / Setup.php esta lista para usar, actualiza tu navegador" 0 50 ;;
|
|
8)
|
|
if [ -f "/var/www/p25/setup.php" ]
|
|
then
|
|
rm /var/www/p25/setup.php
|
|
whiptail --title "P25Reflector" --msgbox "setup.php has removed / setup.php a sido removido" 0 50
|
|
else
|
|
whiptail --title "P25Reflector" --msgbox "setup.php is not enabled / setup.php no esta habilitado" 0 50
|
|
fi ;;
|
|
9)
|
|
clear
|
|
echo "Update Host files - please wait"
|
|
/usr/bin/python3 /opt/data-mmdvm.py
|
|
|
|
# Lista de servicios a reiniciar
|
|
servicios="P25Reflector.service md380-emuP25b.service analog_bridge1.service analog_bridge2.service mmdvm_bridgeP25b.service p25gatewayP25b.service"
|
|
|
|
# Primero, detener todos los servicios
|
|
for servicio in $servicios; do
|
|
if systemctl is-enabled "$servicio" &>/dev/null || systemctl is-active "$servicio" &>/dev/null; then
|
|
echo "Deteniendo $servicio"
|
|
sudo systemctl stop "$servicio"
|
|
fi
|
|
done
|
|
|
|
# Esperar un momento para asegurarse de que todos los servicios se detengan completamente
|
|
sleep 5
|
|
|
|
# Luego, iniciar todos los servicios
|
|
for servicio in $servicios; do
|
|
echo "Iniciando $servicio"
|
|
sudo systemctl start "$servicio"
|
|
sudo systemctl enable "$servicio" &>/dev/null
|
|
done
|
|
;;
|
|
10)
|
|
menu-p25b
|
|
;;
|
|
11)
|
|
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 " Restore Defauld " \
|
|
8 " 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
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
mcall=$(cat /tmp/mcall.txt)
|
|
mcall=$(echo "$mcall" | tr '[:lower:]' '[:upper:]')
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "DMRId:" 10 60 2>/tmp/mid.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
mid=$(cat /tmp/mid.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "P25 Number ID Reflector:" 10 60 2>/tmp/p25id.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
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)
|
|
|
|
if [ $? != 0 ]; then
|
|
echo "You chose cancel. Returning to main menu."
|
|
continue # Regresar al inicio del bucle sin procesar el resto del caso 1
|
|
fi
|
|
|
|
case "$network" in
|
|
"1")
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "DMR Device id 01-99:" 10 60 2>/tmp/midg.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
midg=$(cat /tmp/midg.txt)
|
|
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "IP or dns server DMR:" 10 60 2>/tmp/sbridge.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
sbridge=$(cat /tmp/sbridge.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "Port server DMR:" 10 60 2>/tmp/sport.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
sport=$(cat /tmp/sport.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "Password server DMR:" 10 60 2>/tmp/spass.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
spass=$(cat /tmp/spass.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "TalkGroup / tg sample: 91" 10 60 2>/tmp/txtg.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
txtg=$(cat /tmp/txtg.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "Line Options / sample: TS2=91; " 10 60 2>/tmp/sopti.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
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
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
sbridge=$(cat /tmp/sbridge.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "Port server XLXD:" 10 60 2>/tmp/sport.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
sport=$(cat /tmp/sport.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "Password server XLXD:" 10 60 2>/tmp/spass.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
spass=$(cat /tmp/spass.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "TalkGroup / tg sample: 91" 10 60 2>/tmp/txtg.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
txtg=$(cat /tmp/txtg.txt)
|
|
whiptail --title "Easy setup P25Bridge" --inputbox "Line Options / sample: XLX:4001 " 10 60 2>/tmp/sopti.txt
|
|
exitstatus=$?
|
|
if [ $exitstatus != 0 ]; then
|
|
echo "You chose cancel. Exiting..."
|
|
exit 1 # Salir del script con un código de error
|
|
fi
|
|
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="/opt/data-files/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
|
|
python3 /opt/data-mmdvm.py
|
|
# Lista de servicios a reiniciar
|
|
servicios="md380-emuP25b.service analog_bridge1.service analog_bridge2.service mmdvm_bridgeP25b.service p25gatewayP25b.service"
|
|
|
|
# Primero, detener todos los servicios
|
|
for servicio in $servicios; do
|
|
if systemctl is-enabled "$servicio" &>/dev/null || systemctl is-active "$servicio" &>/dev/null; then
|
|
echo "Deteniendo $servicio"
|
|
sudo systemctl stop "$servicio"
|
|
fi
|
|
done
|
|
|
|
# Esperar un momento para asegurarse de que todos los servicios se detengan completamente
|
|
sleep 5
|
|
|
|
# Luego, iniciar todos los servicios
|
|
for servicio in $servicios; do
|
|
echo "Iniciando $servicio"
|
|
sudo systemctl start "$servicio"
|
|
sudo systemctl enable "$servicio" &>/dev/null
|
|
done
|
|
whiptail --title "Easy setup P25Bridge" --msgbox "Configuracion finalizada" 0 50
|
|
;;
|
|
2)
|
|
python3 /opt/data-mmdvm.py
|
|
# Lista de servicios a reiniciar
|
|
servicios="md380-emuP25b.service analog_bridge1.service analog_bridge2.service mmdvm_bridgeP25b.service p25gatewayP25b.service"
|
|
|
|
# Primero, detener todos los servicios
|
|
for servicio in $servicios; do
|
|
if systemctl is-enabled "$servicio" &>/dev/null || systemctl is-active "$servicio" &>/dev/null; then
|
|
echo "Deteniendo $servicio"
|
|
sudo systemctl stop "$servicio"
|
|
fi
|
|
done
|
|
|
|
# Esperar un momento para asegurarse de que todos los servicios se detengan completamente
|
|
sleep 5
|
|
|
|
# Luego, iniciar todos los servicios
|
|
for servicio in $servicios; do
|
|
echo "Iniciando $servicio"
|
|
sudo systemctl start "$servicio"
|
|
sudo systemctl enable "$servicio" &>/dev/null
|
|
done
|
|
;;
|
|
3)
|
|
# 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 is-enabled "$servicio" &>/dev/null || systemctl is-active "$servicio" &>/dev/null; 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)
|
|
# 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 is-enabled "$servicio" | grep "enabled" >/dev/null 2>&1; then
|
|
echo "stop $servicio"
|
|
sudo systemctl disable "$servicio"
|
|
sudo systemctl stop "$servicio"
|
|
fi
|
|
done
|
|
sudo cat > /opt/p25bridge/Analog_Bridge_DMR.ini <<- "EOFB1"
|
|
[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
|
|
|
|
EOFB1
|
|
sudo cat > /opt/p25bridge/Analog_Bridge_P25.ini <<- "EOFB2"
|
|
[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
|
|
|
|
|
|
EOFB2
|
|
sudo cat > /opt/p25bridge/MMDVM_Bridge.ini <<- "EOFB3"
|
|
[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=/opt/data-files/DMRId.dat
|
|
Time=24
|
|
|
|
[NXDN Id Lookup]
|
|
File=/opt/data-files/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=240
|
|
Local=62136
|
|
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
|
|
|
|
|
|
EOFB3
|
|
sudo cat > /opt/p25bridge/P25Gateway.ini <<- "EOFB4"
|
|
[General]
|
|
Callsign=HP3ICC
|
|
RptAddress=127.0.0.1
|
|
RptPort=32810
|
|
LocalPort=42820
|
|
Debug=0
|
|
Daemon=0
|
|
|
|
[Id Lookup]
|
|
Name=/opt/data-files/DMRId.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
|
|
#/opt/data-files/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
|
|
|
|
EOFB4
|
|
#
|
|
sudo cat > /opt/p25bridge/DVSwitch.ini <<- "EOFB5"
|
|
; 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
|
|
|
|
EOFB5
|
|
;;
|
|
8)
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
exit 0
|
|
EOF
|
|
#########
|
|
sudo chmod +x /bin/menu-p25r
|
|
sudo chmod +x /bin/menu-p25b
|
|
ln -sf /bin/menu-p25r /bin/MENU-P25R
|
|
ln -sf /bin/menu-p25b /bin/MENU-P25B
|
|
sudo chmod +x /bin/MENU*
|