diff options
Diffstat (limited to 'choco')
-rw-r--r-- | choco/CMakeLists.txt | 6 | ||||
-rw-r--r-- | choco/chocolateyInstall.ps1.template.cmake | 20 | ||||
-rw-r--r-- | choco/chocolateyUninstall.ps1 | 20 | ||||
-rwxr-xr-x | choco/icinga2.nuspec.cmake | 32 |
4 files changed, 78 insertions, 0 deletions
diff --git a/choco/CMakeLists.txt b/choco/CMakeLists.txt new file mode 100644 index 0000000..fb147a1 --- /dev/null +++ b/choco/CMakeLists.txt @@ -0,0 +1,6 @@ +# Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ + +if(WIN32) + configure_file(icinga2.nuspec.cmake icinga2.nuspec) + configure_file(chocolateyInstall.ps1.template.cmake chocolateyInstall.ps1.template) +endif() diff --git a/choco/chocolateyInstall.ps1.template.cmake b/choco/chocolateyInstall.ps1.template.cmake new file mode 100644 index 0000000..424a737 --- /dev/null +++ b/choco/chocolateyInstall.ps1.template.cmake @@ -0,0 +1,20 @@ +$packageName= 'icinga2' +$toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" +$url = 'https://packages.icinga.com/windows/Icinga2-v${CHOCO_VERSION_SHORT}-x86.msi' +$url64 = 'https://packages.icinga.com/windows/Icinga2-v${CHOCO_VERSION_SHORT}-x86_64.msi' + +$packageArgs = @{ + packageName = $packageName + fileType = 'msi' + url = $url + url64bit = $url64 + silentArgs = "/qn /norestart" + validExitCodes= @(0) + softwareName = 'Icinga 2*' + checksum = '%CHOCO_32BIT_CHECKSUM%' + checksumType = 'sha256' + checksum64 = '%CHOCO_64BIT_CHECKSUM%' + checksumType64= 'sha256' +} + +Install-ChocolateyPackage @packageArgs
\ No newline at end of file diff --git a/choco/chocolateyUninstall.ps1 b/choco/chocolateyUninstall.ps1 new file mode 100644 index 0000000..a41b351 --- /dev/null +++ b/choco/chocolateyUninstall.ps1 @@ -0,0 +1,20 @@ +$packageName = "Icinga 2"; +$fileType = 'msi'; +$silentArgs = '/qr /norestart' +$validExitCodes = @(0) + +$packageGuid = Get-ChildItem HKLM:\SOFTWARE\Classes\Installer\Products | + Get-ItemProperty -Name 'ProductName' | + ? { $_.ProductName -like $packageName + "*"} | + Select -ExpandProperty PSChildName -First 1 + +$properties = Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\$packageGuid\InstallProperties + +$file = $properties.LocalPackage + +# Would like to use the following, but looks like there is a bug in this method when uninstalling MSI's +# Uninstall-ChocolateyPackage $packageName $fileType $silentArgs $file -validExitCodes $validExitCodes + +# Use this instead +$msiArgs = "/x $file $silentArgs"; +Start-ChocolateyProcessAsAdmin "$msiArgs" 'msiexec' -validExitCodes $validExitCodes diff --git a/choco/icinga2.nuspec.cmake b/choco/icinga2.nuspec.cmake new file mode 100755 index 0000000..d0699f2 --- /dev/null +++ b/choco/icinga2.nuspec.cmake @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?>
+<!-- Do not remove this test for UTF-8: if ??? doesn?t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
+<!--package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"-->
+<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <metadata>
+ <!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
+ <id>icinga2</id>
+ <title>Icinga 2</title>
+ <version>${ICINGA2_VERSION_SAFE}</version>
+ <authors>Icinga GmbH</authors>
+ <owners>Icinga GmbH</owners>
+ <summary>icinga2 - Monitoring Agent for Windows</summary>
+ <description>Icinga is an open source monitoring platform which notifies users about host and service outages.</description>
+ <projectUrl>https://icinga.com/</projectUrl>
+ <tags>icinga2 icinga agent monitoring admin</tags>
+ <licenseUrl>https://github.com/Icinga/icinga2/blob/master/COPYING</licenseUrl>
+ <releaseNotes>https://github.com/Icinga/icinga2/blob/master/ChangeLog</releaseNotes>
+ <docsUrl>https://icinga.com/docs/icinga2/latest/</docsUrl>
+ <bugTrackerUrl>https://github.com/Icinga/icinga2/issues</bugTrackerUrl>
+ <packageSourceUrl>https://github.com/Icinga/icinga2</packageSourceUrl>
+ <projectSourceUrl>https://github.com/Icinga/icinga2</projectSourceUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <iconUrl>https://raw.githubusercontent.com/Icinga/icinga2/master/icinga-app/icinga.ico</iconUrl>
+ <dependencies>
+ <dependency id='netfx-4.6.2' />
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1" target="tools" />
+ <file src="${CMAKE_CURRENT_SOURCE_DIR}/chocolateyUninstall.ps1" target="tools" />
+ </files>
+</package>
|