#!/usr/bin/env bash # # bootstrap launcher — curl | bash # # This file is intentionally tiny and stable: its only job is to clone the # bootstrap repo (or update an existing clone) and hand off to setup.sh. # All real logic lives in the repo so you can update it with `git pull`. # # Usage: # curl -fsSL | bash # curl -fsSL | bash -s -- --yes # curl -fsSL | bash -s -- --only packages set -euo pipefail REPO_URL="${BOOTSTRAP_REPO:-https://g.mk.fo/bootstrap/main.git}" CLONE_DIR="${BOOTSTRAP_HOME:-$HOME/.bootstrap}" need() { command -v "$1" >/dev/null 2>&1 || { echo "bootstrap: missing required command: $1" >&2; exit 1; }; } need git if [[ -d "$CLONE_DIR/.git" ]]; then echo ">> existing bootstrap at $CLONE_DIR — pulling updates" git -C "$CLONE_DIR" pull --ff-only else if [[ -d "$CLONE_DIR" ]]; then mv "$CLONE_DIR" "${CLONE_DIR}.bak.$(date +%Y%m%d-%H%M%S)" echo ">> backed up old $CLONE_DIR" fi echo ">> cloning $REPO_URL -> $CLONE_DIR" git clone --depth 1 "$REPO_URL" "$CLONE_DIR" fi exec bash "$CLONE_DIR/setup.sh" "$@"