#!/bin/sh
set -e

# Check root
if [ "$(id -u)" -ne 0 ]; then
  echo "[-] Please run with sudo: curl -fsSL https://get.hackmasterpi.org/ | sudo sh"
  exit 1
fi

# Switch to full root environment
export HOME=/root
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

echo "[*] Installing HackMaster Pi..."

# Install git
apt install -y git

# Clone the repository
git clone https://github.com/1PingSun/HackMaster-Pi.git

# Run setup
cd HackMaster-Pi
chmod +x setup.sh
./setup.sh

echo "[✓] Done!"