#!/usr/bin/env bash # Fetch zexall.com (Frank Cringle's Z80 instruction exerciser, GPL-2.0) from # https://github.com/agn453/ZEXALL (where z80-python's docs/validation.md says # to get it) into external/, which .gitignore keeps out of the tree. The URL # names a fixed commit and the file is verified by SHA-256 against the hash # z80-python and z80-rust-fast pin; a file that does not match is discarded. # Fetched as evidence, never vendored (emulator-lineage docs/sources.md). The # page serves the fetched copy from dist/zex/ (scripts/build-dist.sh). # Usage: scripts/fetch_zexall.sh set -euo pipefail ROOT=$(cd "$(dirname "$0")/.." && pwd) OUT="$ROOT/external/zexall.com" SHA=6e2da55147a04f28d303d5da6a1e6b771557ac244653590a0f24a2d39c8537e8 # agn453/ZEXALL main as of 2026-11-26; zexall.com last changed in ee6ab9a # (2021-08-23, "Initial upload") and has the same SHA-256 at both commits. COMMIT=8f71d418bae69a476a5a0e5c6e122c8801b8d9f4 URL="https://raw.githubusercontent.com/agn453/ZEXALL/$COMMIT/zexall.com" if [ -f "$OUT" ] && echo "$SHA $OUT" | sha256sum -c --quiet 2>/dev/null; then echo "external/zexall.com present and verified"; exit 0 fi mkdir -p "$ROOT/external" tmp="$OUT.part" curl -sSL --fail --max-time 120 "$URL" -o "$tmp" if ! echo "$SHA $tmp" | sha256sum -c --quiet; then mv "$tmp" "$OUT.bad" echo "zexall.com from $URL does not match the pinned SHA-256; kept as external/zexall.com.bad" >&2 exit 1 fi mv "$tmp" "$OUT" echo "fetched external/zexall.com ($(stat -c %s "$OUT") bytes, SHA-256 verified)"