#!/usr/bin/env bash

set -euo pipefail

REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

require_command() {
    local command_name="$1"

    if ! command -v "$command_name" >/dev/null 2>&1; then
        echo "Missing required command: $command_name"
        exit 1
    fi
}

echo "========================================"
echo " Milan's Omarchy Bootstrap"
echo "========================================"
echo

require_command yay
require_command systemctl
require_command fc-cache

if [[ ! -f "$REPO_DIR/tracked-configs.txt" ]]; then
    echo "Missing tracked-configs.txt"
    exit 1
fi

chmod +x "$REPO_DIR/install.sh"
"$REPO_DIR/install.sh"
