#!/usr/bin/env bash # Initialize pinned components and check non-Python runtime dependencies. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" check_only=false if [[ "${1:-}" == "--check" ]]; then check_only=true elif [[ $# -ne 0 ]]; then echo "Usage: $0 [--check]" >&2 exit 2 fi missing=() for command in git typst; do command -v "$command" >/dev/null 2>&1 || missing+=("$command") done if ((${#missing[@]})); then echo "Missing required tools: ${missing[*]}" >&2 echo 'Install Git and Typst, then rerun bootstrap.' >&2 exit 1 fi if ! $check_only; then git submodule update --init --recursive fi for component in reporter reports; do if [[ ! -e "$component/.git" ]]; then echo "Missing component checkout: $component" >&2 echo 'Run ./bootstrap.sh with network access to initialize pinned submodules.' >&2 exit 1 fi done while IFS= read -r status; do if [[ "$status" == -* || "$status" == +* ]]; then echo "Submodule is not at its pinned revision: $status" >&2 echo 'Run ./bootstrap.sh to restore the recorded component revisions.' >&2 exit 1 fi done < <(git submodule status --recursive) git --version typst --version if $check_only; then echo 'Pinned components and required tools are available.' exit 0 fi echo 'Bootstrap complete. Run scripts/check-components.sh to verify the workspace.'