#!/usr/bin/env bash # scripts/install.sh — Lumina staged installer # # Runs install stages S0b–S2 (S3+ not yet implemented). # # Usage: # ./scripts/install.sh # run all implemented stages (S0b–S2) # ./scripts/install.sh --stage s1 # run only S1 # ./scripts/install.sh --stage s2 # run only S2 # ./scripts/install.sh --help # # All stages are idempotent. Re-running is safe. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" # Source shared helpers # shellcheck source=lib/common.sh source "$SCRIPT_DIR/lib/common.sh" # ── Usage ────────────────────────────────────────────────────────────────── usage() { cat < Run only the specified stage --help Show this help Stages: S0b Docker install-if-missing (bootstrap) S1 Repository environment (.env) S2 Model + vision configuration + smoke test All stages are idempotent. Examples: $(basename "$0") # run S0b → S1 → S2 $(basename "$0") --stage s1 # run only S1 (env) $(basename "$0") --stage s2 # run only S2 (models) EOF } # ── Parse args ───────────────────────────────────────────────────────────── SINGLE_STAGE="" while [[ $# -gt 0 ]]; do case "$1" in --help|-h) usage; exit 0 ;; --stage) shift SINGLE_STAGE="${1:-}" if [[ -z "$SINGLE_STAGE" ]]; then log_error "--stage requires a value (s1 or s2)" exit 1 fi shift ;; *) log_error "Unknown argument: $1" usage exit 1 ;; esac done # ── Run stages ───────────────────────────────────────────────────────────── run_s0b() { log_section "S0b: Docker bootstrap" bash "$SCRIPT_DIR/bootstrap.sh" } run_s1() { bash "$SCRIPT_DIR/install/s1-env.sh" } run_s2() { bash "$SCRIPT_DIR/install/s2-models.sh" } log_section "Lumina installer (stages S0b–S2)" warn_if_root if [[ -n "$SINGLE_STAGE" ]]; then case "$SINGLE_STAGE" in s0b) run_s0b ;; s1) run_s1 ;; s2) run_s2 ;; *) log_error "Unknown stage: $SINGLE_STAGE" log_error "Valid stages: s0b, s1, s2" exit 1 ;; esac else # Run all implemented stages in order run_s0b run_s1 run_s2 fi log_section "Install complete (S0b–S2)" log_info "Next steps:" log_info " - Review .env for correctness" log_info " - Continue with S3+ when implemented (compose, sandbox, policy)" log_info " - See docs/INSTALL.md for full procedure"