#!/usr/bin/env bash
# Root-level provisioning. Run on the installed system as root:
#   sudo ./run.sh
set -euo pipefail
cd "$(dirname "$0")"
source lib.sh
source ../system.conf   # GPU, IS_DESKTOP, …

[ "$(id -u)" -eq 0 ] || die "run as root"
[ -n "${GPU:-}" ] && [ -n "${IS_DESKTOP:-}" ] || die "set GPU and IS_DESKTOP in system.conf"
info "provisioning (GPU=$GPU, desktop=$IS_DESKTOP)"

# run every numbered step in order; each is independently re-runnable
for step in [0-9][0-9]-*.sh; do
  info "--- $step ---"
  source "$step"
done

info "system provisioning done. Next: run 03-user/run.sh as your user."
