From 8ade3d717574b0200b5771ba631620376d7ed38d Mon Sep 17 00:00:00 2001 From: Maurice Kevenaar Date: Wed, 18 Oct 2023 13:15:26 +0200 Subject: [PATCH] (zabbix-agent) fix zabbix-agent (#210) --- automatic/zabbix-agent.install/update.ps1 | 3 ++- automatic/zabbix-agent/update.ps1 | 12 +++++++----- automatic/zabbix-agent2/update.ps1 | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/automatic/zabbix-agent.install/update.ps1 b/automatic/zabbix-agent.install/update.ps1 index 4386f0a590..911be2aebd 100644 --- a/automatic/zabbix-agent.install/update.ps1 +++ b/automatic/zabbix-agent.install/update.ps1 @@ -45,7 +45,8 @@ function global:au_GetLatest { try { $majVersionFolder = $_.href $version_download_page = Invoke-WebRequest -UseBasicParsing -Uri "$releases$majVersionFolder" - $version = $version_download_page.Links | Select-Object -ExpandProperty href | ForEach-Object{ Get-Version ($_) -ErrorAction SilentlyContinue } | Sort-Object | Select-Object -Last 1 + $majVersion = Get-Version $majVersionFolder + $version = $version_download_page.Links | Where-Object -Property href -Match $majVersion| Select-Object -ExpandProperty href | ForEach-Object{ Get-Version ($_) } | Sort-Object | Select-Object -Last 1 $url32Bit = "${releases}${majVersionFolder}${version}/zabbix_agent-${version}-windows-i386-openssl.msi" $url64Bit = "${releases}${majVersionFolder}${version}/zabbix_agent-${version}-windows-amd64-openssl.msi" diff --git a/automatic/zabbix-agent/update.ps1 b/automatic/zabbix-agent/update.ps1 index ef1a70efdb..722a7396b7 100644 --- a/automatic/zabbix-agent/update.ps1 +++ b/automatic/zabbix-agent/update.ps1 @@ -5,7 +5,7 @@ $releases = 'https://cdn.zabbix.com/zabbix/binaries/stable/' function global:au_SearchReplace { @{ ".\tools\chocolateyInstall.ps1" = @{ - "(?i)(version\s*=\s*)('.*')" = "`$1'$($Latest.Version)'" + "(?i)(version\s*=\s*)('.*')" = "`$1'$($Latest.ChocoVersion)'" "(?i)(^\s*file\s*=\s*`"[$]toolsDir\\).*" = "`${1}$($Latest.FileName32)`"" "(?i)(^\s*file64\s*=\s*`"[$]toolsDir\\).*" = "`${1}$($Latest.FileName64)`"" } @@ -27,9 +27,10 @@ function CreateStream { param($url32bit, $url64bit, $version) $Result = @{ - Version = $version - URL32 = $url32bit - URL64 = $url64bit + ChocoVersion = $version + Version = $version + URL32 = $url32bit + URL64 = $url64bit } return $Result @@ -46,7 +47,8 @@ function global:au_GetLatest { try { $majVersionFolder = $_.href $version_download_page = Invoke-WebRequest -UseBasicParsing -Uri "$releases$majVersionFolder" - $version = $version_download_page.Links | Select-Object -ExpandProperty href | ForEach-Object{ Get-Version ($_) -ErrorAction SilentlyContinue } | Sort-Object | Select-Object -Last 1 + $majVersion = Get-Version $majVersionFolder + $version = $version_download_page.Links | Where-Object -Property href -Match $majVersion| Select-Object -ExpandProperty href | ForEach-Object{ Get-Version ($_) } | Sort-Object | Select-Object -Last 1 $url32Bit = "${releases}${majVersionFolder}${version}/zabbix_agent-${version}-windows-i386-openssl.zip" $url64Bit = "${releases}${majVersionFolder}${version}/zabbix_agent-${version}-windows-amd64-openssl.zip" diff --git a/automatic/zabbix-agent2/update.ps1 b/automatic/zabbix-agent2/update.ps1 index fbbb23cf67..9827d0e6a4 100644 --- a/automatic/zabbix-agent2/update.ps1 +++ b/automatic/zabbix-agent2/update.ps1 @@ -45,7 +45,8 @@ function global:au_GetLatest { try { $majVersionFolder = $_.href $version_download_page = Invoke-WebRequest -UseBasicParsing -Uri "$releases$majVersionFolder" - $version = $version_download_page.Links | Select-Object -ExpandProperty href | ForEach-Object{ Get-Version ($_) -ErrorAction SilentlyContinue } | Sort-Object | Select-Object -Last 1 + $majVersion = Get-Version $majVersionFolder + $version = $version_download_page.Links | Where-Object -Property href -Match $majVersion| Select-Object -ExpandProperty href | ForEach-Object{ Get-Version ($_) } | Sort-Object | Select-Object -Last 1 $url32Bit = "${releases}${majVersionFolder}${version}/zabbix_agent2-${version}-windows-i386-openssl.msi" $url64Bit = "${releases}${majVersionFolder}${version}/zabbix_agent2-${version}-windows-amd64-openssl.msi"