#!/bin/bash # Nombre del script SCRIPT_NAME="xlx.sh" # Registra el inicio en /opt/curl.txt echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt if [[ $EUID -ne 0 ]]; then whiptail --title "sudo su" --msgbox "requiere ser usuario root , escriba (sudo su) antes de entrar a menu / requires root user, type (sudo su) before entering menu" 0 50 exit 0 fi if systemctl status xlxd.service |grep active >/dev/null 2>&1 then service xlxd stop fi if [ -f "/opt/wdp10" ] then echo "found file" else cat > /opt/wdp10 <<- "EOFX" ######################################### # Select number port, XLXD Dashboard # ######################################### Web-Dashboar-name: XLX Web-Dashboar-Port: 80 Web-Dashboar-dns: Web-Dashboar-dir: /opt/xlxd/dashboard XLX-XRFNUM: XLX-CONTRIE: XLX-DESCRIPTION: XLX-NMODU: XLX-YSFMODU: XLX-YSFPOR: XLX-AMBIP: XLX-AMBPOR: XLX-EMAIL: XLX-CALLSIGN: EOFX fi apt update # WHO=$(whoami) if [ "$WHO" != "root" ] then echo "" echo "You Must be root to run this script!!" exit 0 fi if [ ! -e "/etc/debian_version" ] then echo "" echo "This script is only tested in Debian 9 and x64 cpu Arch. " exit 0 fi DEP="git build-essential" DEP2="git build-essential" DEP3="git build-essential" VERSION=$(sed 's/\..*//' /etc/debian_version) if [ $VERSION = 9 ] then apt-get -y install $DEP elif [ $VERSION = 10 ] then apt-get -y install $DEP2 elif [ $VERSION = 11 ] then apt-get -y install $DEP3 fi ################################################### ##stop dashboard &xlx wdp=/opt/wdp10 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 if [ -f "/etc/init.d/xlxd" ]; then systemctl stop xlxd fi if [ -f "/etc/init.d/xlxd" ]; then rm /etc/init.d/xlxd fi sudo update-rc.d -f xlxd remove # if [ ! -d "/opt/xlx-bk" ]; then mkdir /opt/xlx-bk fi source_folder="/xlxd" backup_folder="/opt/xlx-bk" # Verifica si la carpeta /xlxd/ existe if [ -d "$source_folder" ]; then # Verifica si la carpeta /xlxd/ no está vacía if [ "$(ls -A $source_folder)" ]; then # La carpeta no está vacía, realiza la copia de archivos files_to_backup=( "xlxd.terminal" "xlxd.interlink" "xlxd.whitelist" ) for file in "${files_to_backup[@]}"; do if [ -e "$source_folder/$file" ]; then cp "$source_folder/$file" "$backup_folder/$file" echo "Copia de $file realizada con éxito." else echo "El archivo $file no existe en la carpeta $source_folder." fi done else # La carpeta está vacía echo "La carpeta $source_folder está vacía. No se realizará la copia." fi else # La carpeta no existe echo "La carpeta $source_folder no existe. No se realizará la copia." fi ################################################### #emqte1-xlx if [ -f "/etc/init.d/xlxd" ] then service xlxd stop #echo "found file" fi if [ -f "/etc/init.d/xlxd" ] then rm /etc/init.d/xlxd #echo "found file" fi if [ -d "/root/reflector-install-files" ] then rm -r /root/reflector-install-files/ #echo "found file" fi if [ -d "/root/xlxd" ] then rm -r /root/xlxd/ #echo "found file" fi if [ -d "/xlxd" ] then rm -r /xlxd/ #echo "found file" fi if [ -d "/opt/xlxd" ] then rm -r /opt/xlxd/ #echo "found file" fi if [ -d "/var/www/xlxd" ] then rm -r /var/www/xlxd/ #echo "found file" fi for file in "/usr/local/bin/"xlxd*; do # Verificar si el archivo existe y es un archivo regular if [ -f "$file" ]; then rm "$file" fi done for file in "/usr/local/etc/"xlxd*; do # Verificar si el archivo existe y es un archivo regular if [ -f "$file" ]; then rm "$file" fi done ####################### #INSTALL echo "------------------------------------------------------------------------------" cd /opt git clone https://github.com/LX3JL/xlxd.git #git clone https://github.com/iu5jae/xlxd.git #git clone https://github.com/n7tae/new-xlxd.git xlxd #cd /opt/xlxd/ #mv dashboard.xlx dashboard #mv dashboard.xrf dashboard2 cd /opt/xlxd/src/ echo "------------------------------------------------------------------------------" ####################### #dash1 sudo sed -i "s/mailto:\"><\/a> <\/div>