73 lines
2.1 KiB
PowerShell
73 lines
2.1 KiB
PowerShell
$projectRoot = "C:\Users\surov\Documents\AZA\backup 24.2.26"
|
|
$installerPath = Join-Path $projectRoot "dist\installer\aza_desktop_setup.exe"
|
|
$installDir = Join-Path ${env:ProgramFiles} "AZA Desktop"
|
|
$installedExe = Join-Path $installDir "aza_desktop.exe"
|
|
|
|
function Test-PortOpen {
|
|
param(
|
|
[string]$HostName = "127.0.0.1",
|
|
[int]$Port = 8000
|
|
)
|
|
|
|
try {
|
|
$client = New-Object System.Net.Sockets.TcpClient
|
|
$iar = $client.BeginConnect($HostName, $Port, $null, $null)
|
|
$ok = $iar.AsyncWaitHandle.WaitOne(500)
|
|
if (-not $ok) {
|
|
$client.Close()
|
|
return $false
|
|
}
|
|
$client.EndConnect($iar)
|
|
$client.Close()
|
|
return $true
|
|
}
|
|
catch {
|
|
return $false
|
|
}
|
|
}
|
|
|
|
if (-not (Test-Path $installerPath)) {
|
|
Write-Error "Installer nicht gefunden: $installerPath"
|
|
Write-Host "Bitte zuerst build_installer.ps1 ausführen."
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Starte Installer Smoke Test..."
|
|
Write-Host "Installer: $installerPath"
|
|
|
|
if (Test-PortOpen -HostName "127.0.0.1" -Port 8000) {
|
|
Write-Error "Port 8000 ist bereits belegt. Bitte zuerst alte AZA-/Backend-Instanzen schliessen."
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Installiere AZA Desktop silent..."
|
|
Start-Process -FilePath $installerPath -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait
|
|
|
|
if (-not (Test-Path $installedExe)) {
|
|
Write-Error "Installierte EXE nicht gefunden: $installedExe"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Installierte EXE gefunden:"
|
|
Write-Host $installedExe
|
|
|
|
Write-Host "Starte installierte EXE..."
|
|
$process = Start-Process -FilePath $installedExe -PassThru
|
|
|
|
Start-Sleep -Seconds 6
|
|
|
|
if (-not (Test-PortOpen -HostName "127.0.0.1" -Port 8000)) {
|
|
Write-Error "Backend wurde nach Start der installierten EXE nicht erreichbar."
|
|
if ($process -and -not $process.HasExited) {
|
|
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
|
|
}
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Backend erreichbar. Installer Smoke Test erfolgreich."
|
|
|
|
if ($process -and -not $process.HasExited) {
|
|
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
|
|
Write-Host "Installierte Test-EXE wurde beendet."
|
|
}
|