Files
nyaterm/.github/scripts/assert-win7-installer-content.ps1
Kang 94bd7c8758 feat(webview2): update WebView2 SDK and enhance Windows 7 compatibility
- Updated the WebView2 SDK version to 1.0.1020.30 and adjusted related SHA256 checksums for improved compatibility with Windows 7.
- Added a new function to install the legacy WebView2 loader, ensuring proper handling of loader replacements and validation.
- Enhanced the CI workflow to include steps for enabling Win7-only Cargo patches and verifying the availability of 7-Zip, streamlining the build process for Windows 7 compatibility.
- Introduced a new documentation file to record Windows 7 compatibility vendor patches, detailing necessary adjustments for specific dependencies.
2026-08-19 21:08:38 +08:00

58 lines
1.5 KiB
PowerShell

[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$InstallerPath
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function Find-7Zip {
$command = Get-Command 7z.exe -ErrorAction SilentlyContinue
if ($null -ne $command) {
return $command.Source
}
$commonPaths = @(
(Join-Path $env:ProgramFiles "7-Zip\7z.exe"),
(Join-Path ${env:ProgramFiles(x86)} "7-Zip\7z.exe"),
"C:\ProgramData\chocolatey\bin\7z.exe"
)
foreach ($path in $commonPaths) {
if (Test-Path -LiteralPath $path -PathType Leaf) {
return $path
}
}
throw "Unable to find 7z.exe to inspect the NSIS installer payload."
}
if (!(Test-Path -LiteralPath $InstallerPath -PathType Leaf)) {
throw "Windows 7 installer does not exist: $InstallerPath"
}
$resolvedInstaller = (Resolve-Path -LiteralPath $InstallerPath).Path
$sevenZip = Find-7Zip
$listing = (& $sevenZip l $resolvedInstaller 2>&1 | Out-String)
if ($LASTEXITCODE -ne 0) {
throw "7z.exe failed while inspecting ${resolvedInstaller}:`n$listing"
}
$requiredPatterns = @("webview2-fixed-runtime.*msedgewebview2\.exe")
$missing = @()
foreach ($pattern in $requiredPatterns) {
if ($listing -notmatch $pattern) {
$missing += $pattern
}
}
if ($missing.Count -gt 0) {
Write-Host "NSIS installer listing for diagnosis:"
Write-Host $listing
throw "Windows 7 offline installer is missing expected WebView2 fixed runtime payload entries:`n$($missing -join "`n")"
}
Write-Host "Windows 7 offline installer contains the WebView2 fixed runtime payload: $resolvedInstaller"