Files
windows95/tools/download-disk.ps1
Felix Rieseberg 60ee631575 Fetch disk image from private GitHub release; harden download scripts
OneDrive 1drv.ms links no longer serve raw bytes to headless clients after the SPO migration. The disk image now lives as a release asset on a private repo and is fetched via 'gh release download' using DISK_REPO + DISK_TAG vars and an IMAGES_REPO_TOKEN secret. Scripts fail fast on missing env, bad zip, or missing windows95.img.
2026-04-12 21:21:58 -07:00

37 lines
1.1 KiB
PowerShell

$ErrorActionPreference = "Stop"
# Pulls the disk image from a private GitHub release.
# Requires DISK_REPO, DISK_TAG, GH_TOKEN.
if (-not $env:DISK_REPO) { Write-Host "::error::DISK_REPO not set"; exit 1 }
if (-not $env:DISK_TAG) { Write-Host "::error::DISK_TAG not set"; exit 1 }
if (-not $env:GH_TOKEN) { Write-Host "::error::GH_TOKEN not set"; exit 1 }
New-Item -ItemType Directory -Force -Path images | Out-Null
Set-Location images
gh release download $env:DISK_TAG -R $env:DISK_REPO -p '*.zip' -O images.zip --clobber
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
7z t images.zip | Out-Null
if ($LASTEXITCODE -ne 0) {
$size = (Get-Item images.zip).Length
Write-Host "::error::Downloaded file is not a valid zip (size: $size bytes)."
exit 1
}
7z x images.zip -y -aoa
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Remove-Item images.zip
Remove-Item __MACOSX -Recurse -ErrorAction Ignore
Set-Location ..
if (-not (Test-Path images/windows95.img)) {
Write-Host "::error::images/windows95.img not found after extraction"
Get-ChildItem images
exit 1
}
Get-ChildItem images