#!/bin/bash # Config OWNER="neosubhamoy" REPO="neodlp" DOWNLOAD_DIR=~/Downloads # Check if NeoDLP is already installed echo "### === NeoDLP Installer (Linux) === ###" echo "๐Ÿ” Checking system requirements..." if command -v neodlp &> /dev/null; then echo "โš ๏ธ NeoDLP is already installed at $(which neodlp)" echo "๐Ÿ”„ Proceeding with reinstallation/update..." fi # Detect system architecture ARCH=$(uname -m) if [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then ASSET_ARCH="arm64" echo "๐Ÿง  Detected ARM64 architecture" elif [[ "$ARCH" == "x86_64" ]]; then ASSET_ARCH="x64" echo "๐Ÿง  Detected x86_64 architecture" else echo "โŒ Unsupported architecture: $ARCH" echo "๐Ÿ›‘ Installation aborted." exit 1 fi # Get the latest release tag and version from GitHub API TAG=$(curl -s https://api.github.com/repos/$OWNER/$REPO/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') VERSION=${TAG#v} # Detect package manager and set asset name accordingly if command -v apt &> /dev/null; then ASSET_NAME="NeoDLP_${VERSION}_$([[ "$ASSET_ARCH" == "x64" ]] && echo "amd64" || echo "arm64").deb" PKG_MANAGER="apt" INSTALL_CMD="sudo apt install -y" echo "๐Ÿง Detected debian/ubuntu based distro" elif command -v dnf &> /dev/null; then ASSET_NAME="NeoDLP-${VERSION}-1.$([[ "$ASSET_ARCH" == "x64" ]] && echo "x86_64" || echo "aarch64").rpm" PKG_MANAGER="dnf" INSTALL_CMD="sudo dnf install -y" echo "๐Ÿง Detected rhel/fedora based distro" # Enable RPM Fusion repos if not already enabled (for Fedora) if [ -f /etc/fedora-release ]; then echo "โ„น๏ธ Detected Fedora! Checking RPM Fusion repositories..." # Check if RPM Fusion repositories are enabled if ! dnf repolist enabled | grep -q "rpmfusion-free" || ! dnf repolist enabled | grep -q "rpmfusion-nonfree"; then echo "๐Ÿ“ฆ Enabling RPM Fusion free and nonfree repositories... (sudo required)" sudo dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm sudo dnf install -y https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm if [ $? -eq 0 ]; then echo "โœ… RPM Fusion repositories enabled successfully" else echo "โš ๏ธ Failed to enable RPM Fusion repositories. continuing anyway..." fi else echo "โœ… RPM Fusion repositories already enabled" fi fi elif command -v yum &> /dev/null; then ASSET_NAME="NeoDLP-${VERSION}-1.$([[ "$ASSET_ARCH" == "x64" ]] && echo "x86_64" || echo "aarch64").rpm" PKG_MANAGER="yum" INSTALL_CMD="sudo yum install -y" echo "๐Ÿง Detected older rhel based distro" elif command -v zypper &> /dev/null; then ASSET_NAME="NeoDLP-${VERSION}-1.$([[ "$ASSET_ARCH" == "x64" ]] && echo "x86_64" || echo "aarch64").rpm" PKG_MANAGER="zypper" INSTALL_CMD="sudo zypper install -y" echo "๐Ÿง Detected opensuse based distro" elif command -v pacman &> /dev/null; then echo "๐Ÿง Detected arch based distro" # Check if yay is installed if command -v yay &> /dev/null; then echo "โœ… YAY is already installed" else echo "โ„น๏ธ YAY not found! installing... (sudo required)" # Install yay sudo pacman -S --needed --noconfirm git base-devel cd /tmp git clone https://aur.archlinux.org/yay.git cd yay makepkg -si --noconfirm cd ~ rm -rf /tmp/yay if command -v yay &> /dev/null; then echo "โœ… YAY installed successfully" else echo "โŒ Failed to install YAY" echo "๐Ÿ›‘ Installation aborted." exit 1 fi fi # Install NeoDLP from AUR using yay echo "๐Ÿ“ฆ Installing NeoDLP from AUR using yay..." rm -rf ~/.cache/yay/neodlp yay -S --noconfirm --answerclean=All --answerdiff=None neodlp if command -v neodlp &> /dev/null; then echo "โœ… NeoDLP Installation successful!" exit 0 else echo "โŒ NeoDLP Installation failed!" exit 1 fi else echo "โŒ Unsupported distro: no supported package manager found (apt, dnf, yum, zypper, pacman)" echo "๐Ÿ›‘ Installation aborted." exit 1 fi # Construct the full download URL URL="https://github.com/$OWNER/$REPO/releases/download/$TAG/$ASSET_NAME" # Download the release asset echo "โฌ‡๏ธ Downloading $ASSET_NAME from tag $TAG..." curl -L -o "$DOWNLOAD_DIR/$ASSET_NAME" "$URL" # Install the package echo "๐Ÿ“ฆ Installing $ASSET_NAME using $PKG_MANAGER (sudo required)" $INSTALL_CMD "$DOWNLOAD_DIR/$ASSET_NAME" # Clean up the downloaded package echo "๐Ÿงน Cleaning up..." rm "$DOWNLOAD_DIR/$ASSET_NAME" if command -v neodlp &> /dev/null; then echo "โœ… NeoDLP Installation successful!" exit 0 else echo "โŒ NeoDLP Installation failed!" exit 1 fi