1
0
mirror of https://github.com/Icinga/icinga2.git synced 2025-04-08 17:05:25 +02:00

Merge pull request from Icinga/fix/chocolatey

Remove deprecated Chocolatey functions
This commit is contained in:
Gunnar Beutner 2018-01-15 11:36:54 +01:00 committed by GitHub
commit ab1a2bffcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,27 +2,19 @@ $packageName = "Icinga 2";
$fileType = 'msi';
$silentArgs = '/qr /norestart'
$validExitCodes = @(0)
try {
$packageGuid = Get-ChildItem HKLM:\SOFTWARE\Classes\Installer\Products |
Get-ItemProperty -Name 'ProductName' |
? { $_.ProductName -like $packageName + "*"} |
Select -ExpandProperty PSChildName -First 1
$properties = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\$packageGuid\InstallProperties
$file = $properties.LocalPackage
# Would like to use the following, but looks like there is a bug in this method when uninstalling MSI's
# Uninstall-ChocolateyPackage $packageName $fileType $silentArgs $file -validExitCodes $validExitCodes
# Use this instead
$msiArgs = "/x $file $silentArgs";
Start-ChocolateyProcessAsAdmin "$msiArgs" 'msiexec' -validExitCodes $validExitCodes
Write-ChocolateySuccess $package
}
catch {
Write-ChocolateyFailure $package "$($_.Exception.Message)"
throw
}
$packageGuid = Get-ChildItem HKLM:\SOFTWARE\Classes\Installer\Products |
Get-ItemProperty -Name 'ProductName' |
? { $_.ProductName -like $packageName + "*"} |
Select -ExpandProperty PSChildName -First 1
$properties = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\$packageGuid\InstallProperties
$file = $properties.LocalPackage
# Would like to use the following, but looks like there is a bug in this method when uninstalling MSI's
# Uninstall-ChocolateyPackage $packageName $fileType $silentArgs $file -validExitCodes $validExitCodes
# Use this instead
$msiArgs = "/x $file $silentArgs";
Start-ChocolateyProcessAsAdmin "$msiArgs" 'msiexec' -validExitCodes $validExitCodes