#!/usr/bin/env bash
set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

if [[ -z "${OMARCHY_PATH:-}" ]]; then
  for candidate in "$repo_root/../omarchy-installer" "$repo_root/../omarchy" /usr/share/omarchy; do
    if [[ -f "$candidate/logo.txt" ]]; then
      export OMARCHY_PATH="$candidate"
      break
    fi
  done
fi

# Do a dry-run of the configurator to show the flow without having to do a real installation
exec bash "$repo_root/configs/airootfs/root/configurator" dry "$@"
