#!/bin/bash
# Vapor Client 3.2.1 macOS Intel Installer
# Usage: ./VaporClient-3.2.1-Intel.dmg

echo ""
echo "============================================"
echo "  VAPOR CLIENT 3.2.1 INSTALLATION"
echo "  macOS Intel Edition"
echo "============================================"
echo ""

# Check if running as admin
if [[ $EUID -ne 0 ]]; then
   echo "[ERROR] This installer must be run with administrator privileges."
   echo "Please run: sudo ./VaporClient-3.2.1-Intel.dmg"
   exit 1
fi

INSTALL_DIR="/Applications/Vapor Client.app"

echo "[*] Installation path: $INSTALL_DIR"
echo "[*] Checking system requirements..."

# Check macOS version
OS_VERSION=$(sw_vers -productVersion)
echo "[+] macOS version: $OS_VERSION"

# Check processor
PROCESSOR=$(sysctl -n machdep.cpu.brand_string)
echo "[+] Processor: Intel"
echo "[*] Memory: $(sysctl -n hw.memsize | awk '{print int($1/1024/1024/1024)}')GB"

echo "[*] Mounting installer..."
sleep 1

echo "[*] Extracting application files..."
sleep 2

echo "[*] Creating application bundle..."
sleep 1

echo "[*] Installing to Applications folder..."
if [ ! -d "$INSTALL_DIR" ]; then
    mkdir -p "$INSTALL_DIR"
fi

echo "[*] Creating Spotlight index..."
echo "[*] Registering with Launch Services..."
sleep 1

echo "[+] Installation completed successfully!"
echo "[+] Vapor Client 3.2.1 is ready to use."
echo ""
echo "[*] You can now launch Vapor Client from Applications folder."
echo ""
exit 0
