installer: disable the Restart Manager (#2696)

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Jan-Otto Kröpke
2026-10-12 00:11:25 +02:00
committed by GitHub
co-authored by Claude
parent b297161773
commit 04d841f11c
2 changed files with 21 additions and 3 deletions
+14 -3
View File
@@ -76,7 +76,7 @@ function Write-MsiexecDiagnostic([String] $Log, [DateTime] $Since) {
}
}
function Invoke-Msiexec([String] $Name, [String[]] $Arguments) {
function Invoke-Msiexec([String] $Name, [String[]] $Arguments, [Switch] $PreviousPackage) {
$log = Join-Path $WorkDir "$Name.log"
$allArguments = $Arguments + @('/qn', '/norestart', '/L*v', "`"$log`"")
Write-Host "msiexec $($allArguments -join ' ')"
@@ -87,6 +87,17 @@ function Invoke-Msiexec([String] $Name, [String[]] $Arguments) {
Write-Host " msiexec $Name took $([Math]::Round(((Get-Date) - $since).TotalSeconds, 1)) s, exit code $($process.ExitCode)"
Write-Host " runner after: $(Get-RunnerProcess)"
Write-MsiexecDiagnostic -Log $log -Since $since
# The package disables the Restart Manager, so no operation may shut down
# applications that hold its files. An upgrade removes the previous release
# with the previous package's settings, which still enable it.
if (-not $PreviousPackage -and (Test-Path $log)) {
$shutdown = Select-String -Path $log -Encoding unicode -Pattern 'RESTART MANAGER: Successfully shut down'
if ($null -ne $shutdown) {
throw "msiexec $Name let the Restart Manager shut down applications, see $log"
}
}
# 3010 means success, but a restart is required.
if ($process.ExitCode -ne 0 -and $process.ExitCode -ne 3010) {
throw "msiexec $Name failed with exit code $($process.ExitCode), see $log"
@@ -204,7 +215,7 @@ try {
throw "checksum mismatch for $previousMsi`: $actualHash, expected $expectedHash"
}
Invoke-Msiexec -Name 'install-previous' -Arguments @('/i', "`"$previousMsi`"")
Invoke-Msiexec -Name 'install-previous' -Arguments @('/i', "`"$previousMsi`"") -PreviousPackage
Assert-ServiceRunning | Out-Null
Write-Host '::endgroup::'
@@ -217,7 +228,7 @@ try {
Write-Step 'Upgrade to this build'
Start-Foreign
Invoke-Msiexec -Name 'upgrade' -Arguments @('/i', "`"$UpgradeMsi`"")
Invoke-Msiexec -Name 'upgrade' -Arguments @('/i', "`"$UpgradeMsi`"") -PreviousPackage
$metrics = Assert-ServiceRunning
Assert-InstalledExecutable