aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlili <me@miquellionel.ovh>2019-04-02 13:10:40 +0200
committerlili <me@miquellionel.ovh>2019-04-02 13:10:40 +0200
commit7ac0f7cdcd742cded141a2d0b08164ae853ed1a7 (patch)
treeaf043a557e439965c1d237ecc7a649a1af3233bb
parent82552ea42e63ec1d2f7384288d9ccc0096d8fbd3 (diff)
downloadxidel_chocolatey-7ac0f7cdcd742cded141a2d0b08164ae853ed1a7.tar.gz
xidel_chocolatey-7ac0f7cdcd742cded141a2d0b08164ae853ed1a7.zip
ps1s added
-rw-r--r--tools/chocolateyinstall.ps121
-rw-r--r--tools/chocolateyuninstall.ps136
2 files changed, 57 insertions, 0 deletions
diff --git a/tools/chocolateyinstall.ps1 b/tools/chocolateyinstall.ps1
new file mode 100644
index 0000000..a8c6b95
--- /dev/null
+++ b/tools/chocolateyinstall.ps1
@@ -0,0 +1,21 @@
+
+$ErrorActionPreference = 'Stop';
+$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
+$url = 'https://github.com/benibela/xidel/releases/download/Xidel_0.9.8/xidel-0.9.8.win32.zip'
+
+$packageArgs = @{
+ packageName = $env:ChocolateyPackageName
+ unzipLocation = $toolsDir
+ fileType = 'exe'
+ url = $url
+ url64 = $url
+ softwareName = 'xidel*'
+
+ checksum = '96854C2BE1E3755F56FABB8F00D1FE567108461B9FAB139039219A1B7C17E382'
+ checksumType = 'sha256'
+
+ silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`""
+ validExitCodes= @(0, 3010, 1641)
+}
+
+Install-ChocolateyZipPackage @packageArgs \ No newline at end of file
diff --git a/tools/chocolateyuninstall.ps1 b/tools/chocolateyuninstall.ps1
new file mode 100644
index 0000000..ccdebae
--- /dev/null
+++ b/tools/chocolateyuninstall.ps1
@@ -0,0 +1,36 @@
+
+
+
+$ErrorActionPreference = 'Stop';
+$packageArgs = @{
+ packageName = $env:ChocolateyPackageName
+ softwareName = 'xidel*'
+ fileType = 'exe'
+ silentArgs = "/qn /norestart"
+ validExitCodes= @(0, 3010, 1605, 1614, 1641)
+}
+
+$uninstalled = $false
+[array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName']
+
+if ($key.Count -eq 1) {
+ $key | % {
+ $packageArgs['file'] = "$($_.UninstallString)"
+ if ($packageArgs['fileType'] -eq 'MSI') {
+ $packageArgs['silentArgs'] = "$($_.PSChildName) $($packageArgs['silentArgs'])"
+
+ $packageArgs['file'] = ''
+ }
+
+ Uninstall-ChocolateyZipPackage @packageArgs
+ }
+} elseif ($key.Count -eq 0) {
+ Write-Warning "$packageName has already been uninstalled by other means."
+} elseif ($key.Count -gt 1) {
+ Write-Warning "$($key.Count) matches found!"
+ Write-Warning "To prevent accidental data loss, no programs will be uninstalled."
+ Write-Warning "Please alert package maintainer the following keys were matched:"
+ $key | % {Write-Warning "- $($_.DisplayName)"}
+}
+
+