chore: merge installer fixes, fifth pass

This commit is contained in:
Abdessamad Derraz committed 2026-11-07 00:11:09 +01:00
commit 16f8c869a5
35 files changed
+11023 -330

No files matched your search

+14 -3
View File
@@ -16,7 +16,7 @@
# and Invoke-WebRequest throws on a cut transfer before the hash is read:
# the site's build rewrites this line there (scripts/sitebootstrap.py).
$mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
$defaultInstallSha256 = "b17220355845692a087bbc29cdb4a1008f68b1423d1126f34f00fa0259b53184"
$defaultInstallSha256 = "25a88f9a078717afbe34419481d222d2f6f42c4bf24b4ec64bc3faa9561ea01c"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
@@ -53,8 +53,19 @@
"Check the network connection and any proxy, then run the same command again. " +
"Nothing was run and nothing was written.") -f $url, $_.Exception.Message
}
if ((Get-Item -LiteralPath $temporary).Length -gt $maximumInstallerBytes) {
throw "Downloaded installer exceeds the size limit."
$downloaded = (Get-Item -LiteralPath $temporary).Length
if ($downloaded -gt $maximumInstallerBytes) {
# A page served in place of the file says the network
# answered, not this project: the one cause a user can act on.
$tooLarge = ("The downloaded installer is {0} bytes, more than the {1} this script accepts. " +
"Nothing was run and nothing was written. A network that answers with a page of its own " +
"(a sign-in portal, a proxy) gives this: open any web page to sign in, then run the same " +
"command again.") -f $downloaded, $maximumInstallerBytes
if ([Environment]::GetEnvironmentVariable("RETROBIOS_INSTALL_URL")) {
$tooLarge += " RETROBIOS_INSTALL_URL is set in this session and names another installer: " +
"remove it to use the installer this script names."
}
throw $tooLarge
}
$actual = (Get-FileHash -LiteralPath $temporary -Algorithm SHA256).Hash.ToLowerInvariant()
if ($actual -ne $expected.ToLowerInvariant()) {