Update p25cross.sh

This commit is contained in:
Esteban Mackay Q. 2024-12-26 19:28:40 -05:00
parent 848349b494
commit eeff8849d2
1 changed files with 86 additions and 15 deletions

View File

@ -3,27 +3,98 @@ SCRIPT_NAME="p25cross.sh"
# Registra el inicio en /opt/curl.txt
echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt
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
if [ "$EUID" -ne 0 ]; then
echo "Este script debe ejecutarse como root."
exit 1
fi
# REPO DVS
if [[ -f /etc/debian_version ]]; then
# Obtener versión del sistema operativo Debian
DEBIAN_VERSION=$(cat /etc/debian_version)
# Verificar si es Debian 12 (Bookworm) y si el sistema es 64-bit
if [[ "$DEBIAN_VERSION" == *"12"* && ("$(uname -m)" == "x86_64" || "$(uname -m)" == "arm64") ]]; then
# Ejecutar el script para Debian 12 x64
echo "Ejecutando para Debian 12 x64..."
cd /opt
wget https://dvswitch.org/bookworm
chmod +x bookworm
./bookworm
else
# Ejecutar el script para otro sistema Debian
echo "Ejecutando para otro sistema Debian..."
cd /opt
wget http://dvswitch.org/buster
sudo chmod +x buster
./buster
fi
else
# Si no es Debian
echo "Este no es un sistema Debian, ejecutando el script genérico..."
cd /opt
wget http://dvswitch.org/buster
sudo chmod +x buster
./buster
fi
# UPDATE
if [ -f "/etc/os-release" ]; then
source /etc/os-release
if [ "$VERSION_ID" == "10" ]; then
apt update -y
apt upgrade -y
apt --fix-broken install -y
else
apt-get update
apt-get upgrade -y
fi
fi
if [ -d "/opt/p25bridge" ]
then
rm -r /opt/p25bridge
fi
if [ ! -f "/opt/MMDVM_Bridge/MMDVM_Bridge" ]; then
apt-get install MMDVM_Bridge -y && wait
fi
# bridge
if [ ! -f "/opt/Analog_Bridge/Analog_Bridge" ]; then
apt-get install Analog_Bridge -y && wait
# Verificar si el sistema operativo es Debian 10
source /etc/os-release
if [ "$VERSION_ID" == "10" ]; then
apt install Analog_Bridge -y
else
apt-get install Analog_Bridge -y
fi
fi
if [ ! -f "/opt/MMDVM_Bridge/MMDVM_Bridge" ]; then
# Verificar si el sistema operativo es Debian 10
source /etc/os-release
if [ "$VERSION_ID" == "10" ]; then
apt install MMDVM_Bridge -y
else
apt-get install MMDVM_Bridge -y
fi
fi
#Qemu
if [[ -f /etc/debian_version ]]; then
# Obtener versión del sistema operativo Debian
DEBIAN_VERSION=$(cat /etc/debian_version)
# Verificar si es Debian 12 (Bookworm) y si el sistema es 64-bit
if [[ "$DEBIAN_VERSION" == *"12"* && ("$(uname -m)" == "x86_64" || "$(uname -m)" == "arm64") ]]; then
# Ejecutar el script para Debian 12 x64
echo "Ejecutando para Debian 12 x64..."
wget https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/qemu_x86-64.zip -O /usr/bin/qemu_x86-64.zip
unzip -o /usr/bin/qemu_x86-64.zip -d /usr/bin/
sudo rm /usr/bin/qemu_x86-64.zip
sudo chmod +x /usr/bin/qemu-arm-static
# Verificar y reiniciar servicios cuyo nombre empiece con "md380-emu" si están habilitados
for service in $(systemctl list-unit-files --type=service --all | grep '^md380-emu' | awk '{print $1}'); do
if systemctl is-enabled "$service" | grep -q 'enabled'; then
sudo systemctl restart "$service" > /dev/null 2>&1
fi
done
fi
fi
# Lista de servicios a reiniciar
servicios=("md380-emu.service" "analog_bridge.service" "mmdvm_bridge.service")