#!/bin/sh # install.sh — Entry point for: curl -sSL https://setup.cnr.ad | sh # # This is a tiny POSIX sh wrapper that downloads the full bootstrap script # to a temp file and runs it with bash. This avoids three problems with # piping directly to sh: # 1. stdin is the curl stream, so interactive prompts break # 2. bash-specific syntax (arrays, [[ ]]) breaks in POSIX sh # 3. a network hiccup mid-pipe can corrupt execution # # Host this file at https://setup.cnr.ad. The real logic lives in bootstrap.sh. set -e BOOTSTRAP_URL="https://git.bunk3r.dev/c0nrad/nix/raw/branch/main/bootstrap.sh" # --- Preflight checks --- if [ "$(uname -s)" != "Darwin" ]; then echo "Error: This script is for macOS only." >&2 exit 1 fi if ! command -v curl >/dev/null 2>&1; then echo "Error: curl is required but not found." >&2 exit 1 fi # --- Download and run --- tmpfile="$(mktemp)" trap 'rm -f "$tmpfile"' EXIT echo "Downloading bootstrap script..." curl -fsSL "$BOOTSTRAP_URL" -o "$tmpfile" chmod +x "$tmpfile" echo "Starting bootstrap..." exec bash "$tmpfile"