build: choco: add chocolateyUninstall.ps1

This commit is contained in:
Bill Zissimopoulos 2017-03-10 10:37:19 -08:00
parent 709ead9e06
commit 3ddc2249f6
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,36 @@
$ErrorActionPreference = 'Stop';
$packageName = 'winfsp'
$softwareName = 'WinFsp*'
$installerType = 'msi'
$silentArgs = '/qn /norestart'
$validExitCodes = @(0, 3010, 1605, 1614, 1641)
[array]$key = Get-UninstallRegistryKey -SoftwareName $softwareName
if ($key.Count -eq 1) {
$key | % {
# The Product Code GUID is all that should be passed for MSI, and very
# FIRST, because it comes directly after /x, which is already set in the
# Uninstall-ChocolateyPackage msiargs (facepalm).
$silentArgs = "$($_.PSChildName) $silentArgs"
# Don't pass anything for file, it is ignored for msi (facepalm number 2)
# Alternatively if you need to pass a path to an msi, determine that and
# use it instead of the above in silentArgs, still very first
$file = ''
Uninstall-ChocolateyPackage `
-PackageName $packageName `
-FileType $installerType `
-SilentArgs "$silentArgs" `
-ValidExitCodes $validExitCodes `
-File "$file"
}
} elseif ($key.Count -eq 0) {
Write-Warning "$packageName has already been uninstalled by other means."
} elseif ($key.Count -gt 1) {
Write-Warning "Too many matching packages found! Package may not be uninstalled."
Write-Warning "Please alert package maintainer the following packages were matched:"
$key | % {Write-Warning "- $_"}
}

View File

@ -41,6 +41,7 @@ Some of the benefits of using WinFsp are listed below:
<files>
<file src="chocolateyInstall.ps1" target="tools" />
<file src="chocolateyUninstall.ps1" target="tools" />
<file src="winfsp-$version$.msi" target="tools" />
</files>
</package>