Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions scripts/windows/msi-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ param (
[string]$BuildDir = "."
)

# Clean up leftovers of a previous test run that did not complete its
# uninstall (e.g. was killed, or the uninstall failed to remove files).
# A leftover data directory makes the MSI installation fail with
# "data directory exists and is not empty", permanently, until the
# worker is cleaned.
$svc = Get-Service $ServiceName -ErrorAction SilentlyContinue
if ($svc) {
Write-Output "Removing leftover service $ServiceName"
if ($svc.Status -ne 'Stopped') {
Stop-Service $ServiceName -Force -ErrorAction SilentlyContinue
try { $svc.WaitForStatus('Stopped', '00:01:00') } catch {}
}
sc.exe delete $ServiceName | Out-Null
}
if (Test-Path $InstallDir) {
Write-Output "Removing leftover installation directory $InstallDir"
Remove-Item -Recurse -Force $InstallDir
}

# Look for the first MariaDB MSI file in the $BuildDir
$msiFile = Get-ChildItem -Path $BuildDir -Filter "mariadb-*.msi" | Select-Object -First 1

Expand Down