#!/usr/bin/env bash # Sign an ISO's checksums with the release root (counterpart to sign-manifest.sh). # # Run: bash scripts/sign-iso-checksums.sh path/to/archipelago-X.Y.Z.iso # Then: paste your 24-word release master mnemonic, press Enter, then Ctrl-D. # # Writes .sha256.json next to the ISO — a JSON document carrying the # artifact name, size and sha256, signed by the pinned release-root anchor # (same detached-Ed25519 scheme as the OTA manifest and app catalog). # Verify anywhere with: archipelago ceremony verify .sha256.json # # The mnemonic is read from the terminal only (never stored, never in shell # history). The build host never holds the release key: build emits the plain # .sha256; the publisher signs with this script during the ceremony. set -euo pipefail ISO="${1:-}" [ -n "$ISO" ] || { echo "Usage: $0 path/to/image.iso"; exit 1; } [ -f "$ISO" ] || { echo "Error: $ISO not found"; exit 1; } REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # Use ONLY a prebuilt signer — never compile here (compiling caused hangs in # the earlier catalog ceremony). Prefer the repo's release build. BIN="" for candidate in "$REPO/core/target/release/archipelago" /tmp/archy-sign-bin/release/archipelago; do if [[ -x "$candidate" ]]; then BIN="$candidate"; break; fi done if [[ -z "$BIN" ]]; then echo "⏳ No prebuilt signer found. Build one first:" echo " (cd core && cargo build --release -p archipelago)" echo " Nothing was changed." exit 0 fi ISO_NAME="$(basename "$ISO")" ISO_DIR="$(cd "$(dirname "$ISO")" && pwd)" OUT="$ISO_DIR/$ISO_NAME.sha256.json" echo "Hashing $ISO_NAME (this can take a minute on a large ISO)..." SHA256="$(sha256sum "$ISO" | awk '{print $1}')" SIZE="$(wc -c < "$ISO" | tr -d ' ')" cat > "$OUT" <