#!/bin/bash

# Define variables
URL="https://github.com/Diegiwg/PrismLauncher-Cracked/releases/download/11.0.2-1/PrismLauncher-Linux-x86_64.AppImage"
APP_DIR="$HOME/Applications"
APP_FILE="PrismLauncher-Cracked.AppImage"
APP_PATH="$APP_DIR/$APP_FILE"

# Create the target directory if it doesn't exist
mkdir -p "$APP_DIR"

echo "Downloading Prism Launcher to $APP_PATH..."

# Download using curl or wget
if command -v curl >/dev/null 2>&1; then
    curl -L -o "$APP_PATH" "$URL"
elif command -v wget >/dev/null 2>&1; then
    wget -O "$APP_PATH" "$URL"
else
    echo "Error: Neither curl nor wget is installed. Please install one to proceed."
    exit 1
fi

# Make the AppImage executable
echo "Making the AppImage executable..."
chmod +x "$APP_PATH"

# Launch the AppImage in the background
echo "Starting Prism Launcher..."
"$APP_PATH" > /dev/null 2>&1 &

echo "Done!"
