mirror of
				https://github.com/winfsp/winfsp.git
				synced 2025-10-30 19:48:38 -05:00 
			
		
		
		
	build: choco: rename chocolateyUninstall.ps1 to chocolateyBeforeModify.ps1 to properly handle upgrades
This commit is contained in:
		| @@ -1,36 +0,0 @@ | ||||
| $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 "- $_"} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user