From 78164ae2f95a5326c9191034f61ce216c9c02189 Mon Sep 17 00:00:00 2001 From: Bjoern Strausmann Date: Mon, 10 Jun 2024 10:29:49 +0200 Subject: [PATCH] Fix AU to Chocolatey-AU renaming --- _template/update.ps1 | 2 +- automatic/bambustudio/info | 1 + automatic/bambustudio/update.ps1 | 26 +++++++++++++++++++++++-- automatic/logi-tune/update.ps1 | 2 +- automatic/orcaslicer/update.ps1 | 4 ++-- automatic/pkt/update.ps1 | 10 +++++----- automatic/qemu-guest-agent/update.ps1 | 2 +- automatic/speedtest-by-ookla/update.ps1 | 8 ++++---- manual/sharegate-desktop/update.ps1 | 2 +- 9 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 automatic/bambustudio/info diff --git a/_template/update.ps1 b/_template/update.ps1 index f702c37..ac935a2 100644 --- a/_template/update.ps1 +++ b/_template/update.ps1 @@ -1,4 +1,4 @@ -import-module au +import-module Chocolatey-AU . $PSScriptRoot\..\_scripts\all.ps1 $releases = '' diff --git a/automatic/bambustudio/info b/automatic/bambustudio/info new file mode 100644 index 0000000..0631b14 --- /dev/null +++ b/automatic/bambustudio/info @@ -0,0 +1 @@ +"0x8DC7AC5B6A78F93"| \ No newline at end of file diff --git a/automatic/bambustudio/update.ps1 b/automatic/bambustudio/update.ps1 index 63e4e4d..5a6b173 100644 --- a/automatic/bambustudio/update.ps1 +++ b/automatic/bambustudio/update.ps1 @@ -1,12 +1,32 @@ -Import-Module AU +Import-Module Chocolatey-AU Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" Import-Module "../../scripts/au_extensions.psm1" $release = Get-GitHubRelease bambulab BambuStudio +function GetResultInformation([string]$Url32) { + $fileName = Split-Path -Leaf $Url32 + $dest = "$env:TEMP\$fileName" + + Get-WebFile $Url32 $dest | Out-Null + + $version = (Get-Command $dest).FileVersionInfo.ProductVersion + $ChecksumType = 'sha256' + $checksum32 = Get-FileHash $dest -Algorithm $checksumType | ForEach-Object Hash + + Remove-Item $dest -Force -ErrorAction SilentlyContinue + + @{ + Url32 = $Url32 + Version = $version + Checksum32 = $checksum32 + ChecksumType32 = $ChecksumType + } +} + function global:au_GetLatest { - $Url32 = $release.assets | ? {$_.name -match 'Bambu_Studio_win_public' } | ? { $_.name.endswith('.exe') } | select -First 1 -ExpandProperty browser_download_url + $Url32 = $release.assets | Where-Object {$_.name -match 'Bambu_Studio_win_public' } | Where-Object { $_.name.endswith('.exe') } | Select-Object -First 1 -ExpandProperty browser_download_url $version = $release.tag_name.Trim('v') $ChecksumType = 'sha256' @@ -14,6 +34,8 @@ function global:au_GetLatest { $tag = $release.tag_name $ReleaseNotes = "https://github.com/bambulab/BambuStudio/releases/tag/$($tag)" + Update-OnETagChanged -execUrl $Url32 -OnETagChanged { GetResultInformation $Url32 } -OnUpdated { @{ Url32 = $Url32 } } + @{ Url32 = $Url32 Version = $version diff --git a/automatic/logi-tune/update.ps1 b/automatic/logi-tune/update.ps1 index 380e791..9d163e0 100644 --- a/automatic/logi-tune/update.ps1 +++ b/automatic/logi-tune/update.ps1 @@ -1,4 +1,4 @@ -Import-Module AU +Import-Module Chocolatey-AU Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" Import-Module "../../scripts/au_extensions.psm1" diff --git a/automatic/orcaslicer/update.ps1 b/automatic/orcaslicer/update.ps1 index 43ac054..4cdeec6 100644 --- a/automatic/orcaslicer/update.ps1 +++ b/automatic/orcaslicer/update.ps1 @@ -1,4 +1,4 @@ -Import-Module AU +Import-Module Chocolatey-AU Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" Import-Module "../../scripts/au_extensions.psm1" @@ -6,7 +6,7 @@ Import-Module "../../scripts/au_extensions.psm1" $release = Get-GitHubRelease SoftFever OrcaSlicer function global:au_GetLatest { - $Url32 = $release.assets | ? {$_.name -match 'Windows' } | ? { $_.name.endswith('_portable.zip') } | select -First 1 -ExpandProperty browser_download_url + $Url32 = $release.assets | ? {$_.name -match 'Windows' } | ? { $_.name.endswith('_portable.zip') } | Select-Object -First 1 -ExpandProperty browser_download_url $version = $release.tag_name.Trim('v') $ChecksumType = 'sha256' diff --git a/automatic/pkt/update.ps1 b/automatic/pkt/update.ps1 index 09fe981..6e153b2 100644 --- a/automatic/pkt/update.ps1 +++ b/automatic/pkt/update.ps1 @@ -1,4 +1,4 @@ -Import-Module AU +Import-Module Chocolatey-AU Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" Import-Module "../../scripts/au_extensions.psm1" @@ -10,16 +10,16 @@ function global:au_BeforeUpdate { Get-RemoteFiles -Purge -NoSuffix Set-Alias 7z $Env:chocolateyInstall\tools\7z.exe 7z e tools\*.zip -otools *.exe -r -y - rm tools\*.zip -ea 0 + Remove-Item tools\*.zip -ea 0 } function global:au_GetLatest { $download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing $re = '\PktWorldWalletSetup.exe$' - $url = $download_page.links | ? href -match $re | select -First 1 -expand href - $domain = $releases -split '(?<=//.+)/' | select -First 1 - $version = $url -split '[._-]|.exe' | select -Last 1 -Skip 2 + $url = $download_page.links | ? href -match $re | Select-Object -First 1 -expand href + $domain = $releases -split '(?<=//.+)/' | Select-Object -First 1 + $version = $url -split '[._-]|.exe' | Select-Object -Last 1 -Skip 2 @{ Version = $version diff --git a/automatic/qemu-guest-agent/update.ps1 b/automatic/qemu-guest-agent/update.ps1 index efcf091..3c44c67 100644 --- a/automatic/qemu-guest-agent/update.ps1 +++ b/automatic/qemu-guest-agent/update.ps1 @@ -1,4 +1,4 @@ -Import-Module AU +Import-Module Chocolatey-AU Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" Import-Module "../../scripts/au_extensions.psm1" diff --git a/automatic/speedtest-by-ookla/update.ps1 b/automatic/speedtest-by-ookla/update.ps1 index 6205a29..935c0e3 100644 --- a/automatic/speedtest-by-ookla/update.ps1 +++ b/automatic/speedtest-by-ookla/update.ps1 @@ -1,4 +1,4 @@ -Import-Module AU +Import-Module Chocolatey-AU Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" Import-Module "../../scripts/au_extensions.psm1" @@ -8,11 +8,11 @@ $ChecksumType = 'sha256' function global:au_GetLatest { $web = Invoke-WebRequest $releases - $currentVersion = $web.AllElements | ?{$_.tagname -eq 'SPAN' -and $_.class -eq 'u-note'} | select -First 1 -Expand InnerText + $currentVersion = $web.AllElements | ?{$_.tagname -eq 'SPAN' -and $_.class -eq 'u-note'} | Select-Object -First 1 -Expand InnerText $version = $currentVersion.TrimStart("v") $req = Invoke-WebRequest -Uri $releases - $currentVersion = $req.AllElements | ?{$_.tagname -eq 'SPAN' -and $_.class -eq 'u-note'} | select -First 1 -Expand InnerText + $currentVersion = $req.AllElements | ?{$_.tagname -eq 'SPAN' -and $_.class -eq 'u-note'} | Select-Object -First 1 -Expand InnerText $version = $currentVersion.TrimStart("v") $Url32 = "https://install.speedtest.net/app/windows/$($version)/speedtestbyookla_x86.msi" @@ -42,4 +42,4 @@ function global:au_AfterUpdate { Set-DescriptionFromReadme -SkipFirst 2 } -Update-Package -ChecksumFor all -NoCheckChocoVersion $true \ No newline at end of file +Update-Package -ChecksumFor all -NoCheckChocoVersion $true diff --git a/manual/sharegate-desktop/update.ps1 b/manual/sharegate-desktop/update.ps1 index 588edf4..ada5af3 100644 --- a/manual/sharegate-desktop/update.ps1 +++ b/manual/sharegate-desktop/update.ps1 @@ -1,4 +1,4 @@ -Import-Module AU +Import-Module Chocolatey-AU Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" Import-Module "../../scripts/au_extensions.psm1"