diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:34:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:34:54 +0000 |
commit | 0915b3ef56dfac3113cce55a59a5765dc94976be (patch) | |
tree | a8fea11d50b4f083e1bf0f90025ece7f0824784a /tools/win32/build-choco.ps1 | |
parent | Initial commit. (diff) | |
download | icinga2-0915b3ef56dfac3113cce55a59a5765dc94976be.tar.xz icinga2-0915b3ef56dfac3113cce55a59a5765dc94976be.zip |
Adding upstream version 2.13.6.upstream/2.13.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tools/win32/build-choco.ps1 | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/win32/build-choco.ps1 b/tools/win32/build-choco.ps1 new file mode 100644 index 0000000..32138bd --- /dev/null +++ b/tools/win32/build-choco.ps1 @@ -0,0 +1,42 @@ +Set-PsDebug -Trace 1 + +if(-not (Test-Path "$($env:ProgramData)\chocolatey\choco.exe")) { + throw "Could not find Choco executable. Abort." +} + +if (-not (Test-Path env:ICINGA2_BUILDPATH)) { + $env:ICINGA2_BUILDPATH = '.\build' +} + +if(-not (Test-Path "$($env:ICINGA2_BUILDPATH)\choco\chocolateyInstall.ps1.template")) { + throw "Could not find Chocolatey install script template. Abort." +} + +$chocoInstallScriptTemplatePath = "$($env:ICINGA2_BUILDPATH)\choco\chocolateyInstall.ps1.template" +$chocoInstallScript = Get-Content $chocoInstallScriptTemplatePath + +if(-not (Test-Path "$($env:ICINGA2_BUILDPATH)\*-x86.msi")) { + throw "Could not find Icinga 2 32 bit MSI package. Abort." +} + +$hashMSIpackage32 = Get-FileHash "$($env:ICINGA2_BUILDPATH)\*-x86.msi" +Write-Output "File Hash for 32 bit MSI package: $($hashMSIpackage32.Hash)." + +if(-not (Test-Path "$($env:ICINGA2_BUILDPATH)\*-x86_64.msi")) { + throw "Could not find Icinga 2 64 bit MSI package. Abort." +} + +$hashMSIpackage64 = Get-FileHash "$($env:ICINGA2_BUILDPATH)\*-x86_64.msi" +Write-Output "File Hash for 32 bit MSI package: $($hashMSIpackage64.Hash)" + +$chocoInstallScript = $chocoInstallScript.Replace("%CHOCO_32BIT_CHECKSUM%", "$($hashMSIpackage32.Hash)") +$chocoInstallScript = $chocoInstallScript.Replace("%CHOCO_64BIT_CHECKSUM%", "$($hashMSIpackage64.Hash)") +Write-Output $chocoInstallScript + +Set-Content -Path "$($env:ICINGA2_BUILDPATH)\choco\chocolateyInstall.ps1" -Value $chocoInstallScript + +cd "$($env:ICINGA2_BUILDPATH)\choco" +& "$($env:ProgramData)\chocolatey\choco.exe" "pack" +cd "..\.." + +Move-Item -Path "$($env:ICINGA2_BUILDPATH)\choco\*.nupkg" -Destination "$($env:ICINGA2_BUILDPATH)"
\ No newline at end of file |