From a2ec40008f9d6d7f8296b080b0ee16780e163183 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Wed, 6 Dec 2017 16:24:27 -0800 Subject: [PATCH] build: choco: update chocolatey package as per guidelines from chocolatey admin --- .../{chocolateyBeforeModify.ps1 => chocolateyHelper.ps1} | 2 +- build/choco/chocolateyInstall.ps1 | 8 +++----- build/choco/chocolateyUninstall.ps1 | 4 ++++ build/choco/winfsp.nuspec | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) rename build/choco/{chocolateyBeforeModify.ps1 => chocolateyHelper.ps1} (92%) create mode 100644 build/choco/chocolateyUninstall.ps1 diff --git a/build/choco/chocolateyBeforeModify.ps1 b/build/choco/chocolateyHelper.ps1 similarity index 92% rename from build/choco/chocolateyBeforeModify.ps1 rename to build/choco/chocolateyHelper.ps1 index 22799672..951ffdb6 100644 --- a/build/choco/chocolateyBeforeModify.ps1 +++ b/build/choco/chocolateyHelper.ps1 @@ -28,7 +28,7 @@ if ($key.Count -eq 1) { -File "$file" } } elseif ($key.Count -eq 0) { - Write-Warning "$packageName has already been uninstalled by other means." + # Write-Warning "$packageName is not installed" } 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:" diff --git a/build/choco/chocolateyInstall.ps1 b/build/choco/chocolateyInstall.ps1 index fb369b8d..c9a04a72 100644 --- a/build/choco/chocolateyInstall.ps1 +++ b/build/choco/chocolateyInstall.ps1 @@ -1,16 +1,14 @@ $ErrorActionPreference = 'Stop'; -$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -$fileLocation = @(Get-ChildItem $toolsDir -filter winfsp-*.msi)[0].FullName +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +. "$toolsdir\chocolateyHelper.ps1" $packageArgs = @{ packageName = 'winfsp' fileType = 'msi' - file = $fileLocation + file = @(Get-ChildItem $toolsDir -filter winfsp-*.msi)[0].FullName silentArgs = "/qn /norestart INSTALLLEVEL=1000" validExitCodes = @(0, 3010, 1641) } - Install-ChocolateyInstallPackage @packageArgs - Remove-Item -Force $packageArgs.file diff --git a/build/choco/chocolateyUninstall.ps1 b/build/choco/chocolateyUninstall.ps1 new file mode 100644 index 00000000..801a242b --- /dev/null +++ b/build/choco/chocolateyUninstall.ps1 @@ -0,0 +1,4 @@ +$ErrorActionPreference = 'Stop'; + +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +. "$toolsdir\chocolateyHelper.ps1" diff --git a/build/choco/winfsp.nuspec b/build/choco/winfsp.nuspec index 1220ab39..075d2c1a 100644 --- a/build/choco/winfsp.nuspec +++ b/build/choco/winfsp.nuspec @@ -50,7 +50,8 @@ To verify installation: - + +