#!/bin/bash clear echo "==========================================================" echo " EVE-NG NODE ADD-ON TOOL" echo "==========================================================" echo "You can find more nodes here: https://shortlink.nurhuda.com/s/list-of-node" echo "----------------------------------------------------------" # Ensure gdown is installed if ! command -v gdown &> /dev/null; then echo "Installing gdown..." apt update && apt install python3-pip -y pip3 install gdown fi # Request Google Drive File ID read -p "Enter Google Drive File ID: " GDrive_ID < /dev/tty echo -e "\nDownloading file..." gdown $GDrive_ID -O /tmp/node_archive # Check if file exists and has size if [ ! -s /tmp/node_archive ]; then echo "Error: Download failed or File ID is invalid." exit 1 fi # Detect file type FILE_TYPE=$(file --mime-type -b /tmp/node_archive) case $FILE_TYPE in application/zip) echo "ZIP file detected. Extracting to QEMU addons..." unzip -o /tmp/node_archive -d /opt/unetlab/addons/qemu/ ;; application/x-gzip | application/gzip | application/x-compressed-tar) echo "TAR.GZ file detected. Extracting to QEMU addons..." tar -xvf /tmp/node_archive -C /opt/unetlab/addons/qemu/ ;; *) echo "Single image file detected (qcow2)." read -p "Enter node folder name (e.g., mikrotik-7.12): " FOLDER_NAME < /dev/tty mkdir -p /opt/unetlab/addons/qemu/$FOLDER_NAME mv /tmp/node_archive /opt/unetlab/addons/qemu/$FOLDER_NAME/virtioa.qcow2 ;; esac # Fix Permissions echo -e "\nApplying EVE-NG permissions..." /opt/unetlab/wrappers/unl_wrapper -a fixpermissions echo "----------------------------------------------------------" echo -e "\033[1mDONE! Node has been added successfully.\033[0m" echo -e "\033[1mNow you can refresh your EVE-NG browser.\033[0m" echo "----------------------------------------------------------" # Cleanup rm -f /tmp/node_archive