mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
build: choco: add chocolateyUninstall.ps1
This commit is contained in:
parent
709ead9e06
commit
3ddc2249f6
36
build/choco/chocolateyUninstall.ps1
Normal file
36
build/choco/chocolateyUninstall.ps1
Normal 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 "- $_"}
|
||||
}
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user