diff --git a/test/auto-install.sh b/test/auto-install.sh index b77ecb2..acf57b9 100755 --- a/test/auto-install.sh +++ b/test/auto-install.sh @@ -88,8 +88,27 @@ preflight() { ISO="${1:-}" if [[ -z $ISO ]]; then - echo "Usage: $0 " >&2 - exit 2 + # Auto-fetch from ci-latest GH release if no path given. ISO is split + # into chunks (GH release 2 GiB asset cap). Reassemble before boot. + log "no ISO path given — fetching from gh release ci-latest" + local dl_dir="$HOME/veilor-iso/ci-latest" + mkdir -p "$dl_dir" + ( cd "$dl_dir" && rm -f *.part-* *.iso *.sha256 && \ + gh release download ci-latest --repo veilor-org/veilor-os \ + --pattern '*.iso.part-*' --pattern '*.parts.sha256' --clobber ) || { + echo "[ERR] gh release download failed — is the ci-latest release populated?" >&2 + exit 2 + } + ( cd "$dl_dir" && \ + local stem + stem=$(ls *.part-00 2>/dev/null | head -1 | sed 's/\.part-00$//') + [ -n "$stem" ] || { echo "[ERR] no .part-00 in download"; exit 2; } + log "reassembling $stem from $(ls "$stem".part-* | wc -l) parts" + cat "$stem".part-* > "$stem" + sha256sum -c *.parts.sha256 || { echo "[ERR] reassembly checksum mismatch"; exit 2; } + ) || exit 2 + ISO=$(ls "$dl_dir"/*.iso 2>/dev/null | head -1) + [ -n "$ISO" ] || { echo "[ERR] no iso after reassembly"; exit 2; } fi if [[ ! -f $ISO ]]; then echo "[ERR] ISO not found: $ISO" >&2