#!/usr/bin/env bash
# roundtable.sh/install.sh — public installer entrypoint for Roundtable.
#
# This is the copy served at https://roundtable.sh/install.sh so that
#   curl -fsSL https://roundtable.sh/install.sh | bash
# resolves on day one. The CANONICAL installer lives in the tool repo:
#   https://github.com/frontier-infra/roundtable/blob/main/install.sh
#
# TODO(release): at each release, sync this file byte-for-byte with the tool
# repo's install.sh (CI check). Until then this stub fetches and runs the
# canonical installer from GitHub so the one-liner works regardless.
#
# A Frontier Infra project · MIT License.

set -euo pipefail

REPO_RAW="${ROUNDTABLE_INSTALLER_URL:-https://raw.githubusercontent.com/frontier-infra/roundtable/main/install.sh}"

echo "==> Roundtable installer (frontier-infra)"
echo "    fetching canonical installer: ${REPO_RAW}"

if ! command -v curl >/dev/null 2>&1; then
  echo "error: curl is required to install Roundtable." >&2
  exit 1
fi

# Hand off to the canonical installer in the tool repo.
exec bash -c "$(curl -fsSL "${REPO_RAW}")"
