#!/usr/bin/env bash set -euo pipefail ARCHSETUP_REPO="${ARCHSETUP_REPO:-https://github.com/YOUR_USERNAME/archsetup}" ARCHSETUP_DIR="${ARCHSETUP_DIR:-$HOME/archsetup}" echo "=== Arch Linux Hyprland Setup Bootstrap ===" echo "" # Check if running as root if [ "$EUID" -eq 0 ]; then echo "Error: Do not run as root. Run as a normal user." exit 1 fi # Step 1: Setup sudo access for package installation echo "[1/4] Setting up sudo access..." if ! sudo -n true 2>/dev/null; then echo "$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/local > /dev/null echo "NOPASSWD sudo configured." else echo "Sudo access available." fi # Step 2: Install base requirements (git, ansible) echo "[2/4] Installing base requirements (git, ansible)..." sudo pacman -Sy --noconfirm git ansible # Step 3: Clone or update the repo echo "[3/4] Setting up archsetup..." if [ -d "$ARCHSETUP_DIR/.git" ]; then echo "Updating archsetup..." cd "$ARCHSETUP_DIR" git pull else echo "Cloning archsetup..." git clone "$ARCHSETUP_REPO" "$ARCHSETUP_DIR" fi # Step 4: Run the playbook echo "[4/4] Running Ansible playbook..." cd "$ARCHSETUP_DIR" ansible-playbook site.yml echo "" echo "=== Setup complete! ===" echo "Logout and login again for shell changes to take effect." echo "Restart Hyprland (Super + Shift + Q) to apply new configuration."