|
|
|
|
@ -305,28 +305,69 @@ sudo cat > /opt/fdmr-update.sh <<- "EOFD1"
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
#"libapache2-mod-php"
|
|
|
|
|
|
|
|
|
|
sudo systemctl stop adn-server.service 2>/dev/null || true
|
|
|
|
|
sudo systemctl stop adn-parrot.service 2>/dev/null || true
|
|
|
|
|
sudo systemctl stop proxy.service 2>/dev/null || true
|
|
|
|
|
sudo systemctl stop proxy2.service 2>/dev/null || true
|
|
|
|
|
SERVICIOS="adn-server.service proxy.service proxy2.service adn-parrot.service"
|
|
|
|
|
SERVICIOS2="freedmr.service fdmrparrot.service adn_server.service adn_proxy.service adn_parrot.service"
|
|
|
|
|
|
|
|
|
|
apps="mariadb-server php php-zip php-mbstring php-cli php-common php-curl php-xml php-mysql"
|
|
|
|
|
# Procesar SERVICIOS: solo detener si están activos
|
|
|
|
|
for servicio in $SERVICIOS; do
|
|
|
|
|
# Verificar si el servicio existe
|
|
|
|
|
if systemctl list-unit-files --type=service | grep -q "^$servicio "; then
|
|
|
|
|
echo "El servicio $servicio existe."
|
|
|
|
|
|
|
|
|
|
# Verificar si el servicio está activo y detenerlo
|
|
|
|
|
if systemctl is-active --quiet $servicio; then
|
|
|
|
|
echo "El servicio $servicio está activo. Deteniendo..."
|
|
|
|
|
sudo systemctl stop $servicio
|
|
|
|
|
else
|
|
|
|
|
echo "El servicio $servicio no está activo."
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Procesar SERVICIOS2: detener y deshabilitar
|
|
|
|
|
for servicio in $SERVICIOS2; do
|
|
|
|
|
# Verificar si el servicio existe
|
|
|
|
|
if systemctl list-unit-files --type=service | grep -q "^$servicio "; then
|
|
|
|
|
echo "El servicio $servicio existe."
|
|
|
|
|
|
|
|
|
|
# Verificar si el servicio está activo y detenerlo
|
|
|
|
|
if systemctl is-active --quiet $servicio; then
|
|
|
|
|
echo "El servicio $servicio está activo. Deteniendo..."
|
|
|
|
|
sudo systemctl stop $servicio
|
|
|
|
|
else
|
|
|
|
|
echo "El servicio $servicio no está activo."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Deshabilitar el servicio
|
|
|
|
|
echo "Deshabilitando el servicio $servicio..."
|
|
|
|
|
sudo systemctl disable $servicio
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# === INSTALAR PAQUETES NECESARIOS ===
|
|
|
|
|
apps="sudo curl git make build-essential libusb-1.0-0-dev python3 python3-pip libi2c-dev i2c-tools lm-sensors wget \
|
|
|
|
|
python3-dev python3-venv libffi-dev libssl-dev cargo pkg-config sed libmariadb-dev zip unzip rrdtool openssl \
|
|
|
|
|
wavemon gcc g++ cmake libasound2-dev libudev-dev gpsd libgps-dev gpsd-clients gpsd-tools chrony \
|
|
|
|
|
mariadb-server \
|
|
|
|
|
libsamplerate0-dev ffmpeg php-sqlite3"
|
|
|
|
|
|
|
|
|
|
# Función para verificar e instalar una aplicación
|
|
|
|
|
check_and_install() {
|
|
|
|
|
app=$1
|
|
|
|
|
if ! dpkg -s $app 2>/dev/null | grep -q "Status: install ok installed"; then
|
|
|
|
|
if ! dpkg -s "$app" 2>/dev/null | grep -q "Status: install ok installed"; then
|
|
|
|
|
echo "$app no está instalado. Instalando..."
|
|
|
|
|
sudo apt-get install -y $app
|
|
|
|
|
echo "$app instalado correctamente."
|
|
|
|
|
apt-get install -y "$app" || true
|
|
|
|
|
if dpkg -s "$app" 2>/dev/null | grep -q "Status: install ok installed"; then
|
|
|
|
|
echo "$app instalado correctamente."
|
|
|
|
|
else
|
|
|
|
|
echo "No se pudo instalar $app. Continuando..."
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "$app ya está instalado."
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Verificar e instalar cada aplicación
|
|
|
|
|
for app in $apps; do
|
|
|
|
|
check_and_install $app
|
|
|
|
|
check_and_install "$app"
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
#sudo mysql_secure_installation --host=localhost --port=3306
|
|
|
|
|
@ -357,42 +398,29 @@ echo "${commands}" | /usr/bin/mysql -u root
|
|
|
|
|
cd /
|
|
|
|
|
if [ -f "/opt/FreeDMR/config/FreeDMR.cfg" ]
|
|
|
|
|
then
|
|
|
|
|
variable=$(grep "SERVER_ID:" /opt/FreeDMR/config/FreeDMR.cfg | grep -Eo '[0-9]{1,9}')
|
|
|
|
|
SERVER_ID=$(grep "SERVER_ID:" /opt/FreeDMR/config/FreeDMR.cfg | grep -Eo '[0-9]{1,9}')
|
|
|
|
|
fi
|
|
|
|
|
if [ -f "/opt/adn-server/config/adn.cfg" ]
|
|
|
|
|
then
|
|
|
|
|
variable=$(grep "SERVER_ID:" /opt/adn-server/config/adn.cfg | grep -Eo '[0-9]{1,9}')
|
|
|
|
|
SERVER_ID=$(grep "SERVER_ID:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -Eo '[0-9]{1,9}')
|
|
|
|
|
URL_SECURITY=$(grep "URL_SECURITY:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=URL_SECURITY:\s).*')
|
|
|
|
|
PORT_SECURITY=$(grep "PORT_SECURITY:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -Eo '[0-9]{1,5}')
|
|
|
|
|
PASS_SECURITY=$(grep "PASS_SECURITY:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=PASS_SECURITY:\s).*')
|
|
|
|
|
USERS_PASS=$(grep "USERS_PASS:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=USERS_PASS:\s).*')
|
|
|
|
|
HASH_ENCRYPT=$(grep "HASH_ENCRYPT:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=HASH_ENCRYPT:\s).*')
|
|
|
|
|
fi
|
|
|
|
|
if [ -f "/opt/ADN-DMR-Peer-Server/config/adn.cfg" ]
|
|
|
|
|
then
|
|
|
|
|
variable=$(grep "SERVER_ID:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -Eo '[0-9]{1,9}')
|
|
|
|
|
SERVER_ID=$(grep "SERVER_ID:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -Eo '[0-9]{1,9}')
|
|
|
|
|
URL_SECURITY=$(grep "URL_SECURITY:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=URL_SECURITY:\s).*')
|
|
|
|
|
PORT_SECURITY=$(grep "PORT_SECURITY:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -Eo '[0-9]{1,5}')
|
|
|
|
|
PASS_SECURITY=$(grep "PASS_SECURITY:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=PASS_SECURITY:\s).*')
|
|
|
|
|
USERS_PASS=$(grep "USERS_PASS:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=USERS_PASS:\s).*')
|
|
|
|
|
HASH_ENCRYPT=$(grep "HASH_ENCRYPT:" /opt/ADN-DMR-Peer-Server/config/adn.cfg | grep -oP '(?<=HASH_ENCRYPT:\s).*')
|
|
|
|
|
fi
|
|
|
|
|
if [ -z "$variable" ]
|
|
|
|
|
then variable=0000
|
|
|
|
|
|
|
|
|
|
if [ -z "$SERVER_ID" ]
|
|
|
|
|
then SERVER_ID=0000
|
|
|
|
|
fi
|
|
|
|
|
SERVICIOS="adn-server.service freedmr.service proxy.service adn-parrot.service fdmrparrot.service adn_server.service adn_proxy.service adn_parrot.service"
|
|
|
|
|
|
|
|
|
|
for servicio in $SERVICIOS; do
|
|
|
|
|
# Verificar si el servicio existe
|
|
|
|
|
if systemctl list-unit-files --type=service | grep -q "^$servicio "; then
|
|
|
|
|
echo "El servicio $servicio existe."
|
|
|
|
|
|
|
|
|
|
# Verificar si el servicio está activo
|
|
|
|
|
if systemctl is-active --quiet $servicio; then
|
|
|
|
|
echo "El servicio $servicio está activo. Deteniendo..."
|
|
|
|
|
sudo systemctl stop $servicio
|
|
|
|
|
else
|
|
|
|
|
echo "El servicio $servicio no está activo."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Deshabilitar el servicio
|
|
|
|
|
echo "Deshabilitando el servicio $servicio..."
|
|
|
|
|
sudo systemctl disable $servicio
|
|
|
|
|
else
|
|
|
|
|
echo "El servicio $servicio no existe."
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ -f "/lib/systemd/system/fdmrparrot.service" ];
|
|
|
|
|
then
|
|
|
|
|
@ -414,7 +442,7 @@ fi
|
|
|
|
|
#Service
|
|
|
|
|
sudo cat > /lib/systemd/system/proxy.service <<- "EOF"
|
|
|
|
|
[Unit]
|
|
|
|
|
Description= Proxy Service
|
|
|
|
|
Description=ADN_HOTSPOT_PROXY
|
|
|
|
|
After=multi-user.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
@ -433,7 +461,7 @@ EOF
|
|
|
|
|
#########
|
|
|
|
|
sudo cat > /lib/systemd/system/adn-server.service <<- "EOF"
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=FreeDmr
|
|
|
|
|
Description=ADN_SERVER
|
|
|
|
|
After=multi-user.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
@ -453,7 +481,7 @@ EOF
|
|
|
|
|
###
|
|
|
|
|
sudo cat > /lib/systemd/system/adn-parrot.service <<- "EOF"
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=Freedmr Parrot
|
|
|
|
|
Description=ADN_PARROT
|
|
|
|
|
After=network-online.target syslog.target
|
|
|
|
|
Wants=network-online.target
|
|
|
|
|
|
|
|
|
|
@ -499,18 +527,24 @@ if [ "$(ls -A "/opt/ADN-DMR-Peer-Server/data/")" ]; then
|
|
|
|
|
fi
|
|
|
|
|
sudo chmod -R +x /opt/ADN-DMR-Peer-Server/*
|
|
|
|
|
sudo chmod -R 777 /opt/ADN-DMR-Peer-Server/*
|
|
|
|
|
if [ -f "/etc/os-release" ]; then
|
|
|
|
|
source /etc/os-release
|
|
|
|
|
|
|
|
|
|
if [ "$VERSION_ID" == "12" ]; then
|
|
|
|
|
/usr/bin/python3 -m pip install --break-system-packages -r requirements.txt
|
|
|
|
|
else
|
|
|
|
|
/usr/bin/python3 -m pip install --upgrade -r requirements.txt
|
|
|
|
|
fi
|
|
|
|
|
if grep -q "VERSION_ID=\"1[23]\"" /etc/os-release; then
|
|
|
|
|
/usr/bin/python3 -m pip install --break-system-packages -r requirements.txt
|
|
|
|
|
else
|
|
|
|
|
/usr/bin/python3 -m pip install --upgrade -r requirements.txt
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
####
|
|
|
|
|
cp /opt/ADN-DMR-Peer-Server/config/ADN-SAMPLE.cfg /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo sed -i "s/SERVER_ID:.*/SERVER_ID: $variable/g" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo sed -i "s|SERVER_ID:.*|SERVER_ID: $SERVER_ID|g" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo sed -i "s|URL_SECURITY:.*|URL_SECURITY: $URL_SECURITY|g" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo sed -i "s|PORT_SECURITY:.*|PORT_SECURITY: $PORT_SECURITY|g" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo sed -i "s|PASS_SECURITY:.*|PASS_SECURITY: $PASS_SECURITY|g" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo sed -i "s|USERS_PASS:.*|USERS_PASS: $USERS_PASS|g" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo sed -i "s|HASH_ENCRYPT:.*|HASH_ENCRYPT: $HASH_ENCRYPT|g" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sed -i "/^\[SYSTEM\]/,/^\[/ s|^PASSPHRASE:.*|PASSPHRASE: passw0rd|" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sed -i "/^\[D-APRS\]/,/^\[/ s|^PASSPHRASE:.*|PASSPHRASE: passw0rd|" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sed -i "/^\[ECHO\]/,/^\[/ s|^PASSPHRASE:.*|PASSPHRASE: passw0rd|" /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
sudo cat /opt/obp.txt >> /opt/ADN-DMR-Peer-Server/config/adn.cfg
|
|
|
|
|
|
|
|
|
|
cd /opt/ADN-DMR-Peer-Server/
|
|
|
|
|
@ -1252,7 +1286,8 @@ if [ -d "/opt/adn-dashboard" ]; then
|
|
|
|
|
rm -r /opt/adn-dashboard
|
|
|
|
|
fi
|
|
|
|
|
cd /opt
|
|
|
|
|
git clone https://github.com/Amateur-Digital-Network/ADN-Dashboard.git adn-dashboard
|
|
|
|
|
git clone https://gitlab.com/hp3icc/ADN-Dashboard.git adn-dashboard
|
|
|
|
|
#git clone https://github.com/Amateur-Digital-Network/ADN-Dashboard.git adn-dashboard
|
|
|
|
|
cp /opt/adn-dashboard/proxy/proxy_SAMPLE.cfg /opt/adn-dashboard/proxy/proxy.cfg
|
|
|
|
|
cp /opt/adn-dashboard/dashboard_SAMPLE.cfg /opt/adn-dashboard/dashboard.cfg
|
|
|
|
|
|
|
|
|
|
@ -1368,7 +1403,7 @@ sudo systemctl daemon-reload
|
|
|
|
|
sudo chmod +x /bin/menu*
|
|
|
|
|
|
|
|
|
|
bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/ipv6off.sh)" &&
|
|
|
|
|
bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-fdmr)"
|
|
|
|
|
bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-adn)"
|
|
|
|
|
if [ -d "/opt/ADN-DMR-Peer-Server/" ]; then
|
|
|
|
|
menu-update
|
|
|
|
|
else
|
|
|
|
|
|