From ab05c629783a77ea9e5fe2e814835a5590bd4eb4 Mon Sep 17 00:00:00 2001 From: Ana Maria Martinez Gomez Date: Wed, 6 Nov 2024 12:37:02 +0100 Subject: [PATCH] [regcool.vm] Restore hash installation The new signature verification in `CM-Assert-Signature` using `signtool.exe` does not work for RegCool. Restore the previous installation checking the SHA256. As the tool is using a URL that does not include the version, the hash will change with every update, breaking the package. If the package is updated often, we will need to remove it from the default configuration (replacing it total-registry) or researching if it is possible to use `signtool.exe` to verify the package. Note that the previous package implementation being replaced here had an important bug: `VM-Assert-Signature` was not called at all, as `Get-ChildItem -Path "$toolDir\*.{exe,dll}"` does not match any file. --- packages/regcool.vm/regcool.vm.nuspec | 2 +- .../regcool.vm/tools/chocolateyinstall.ps1 | 34 ++----------------- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/packages/regcool.vm/regcool.vm.nuspec b/packages/regcool.vm/regcool.vm.nuspec index b0692cb21..21d30e9cf 100644 --- a/packages/regcool.vm/regcool.vm.nuspec +++ b/packages/regcool.vm/regcool.vm.nuspec @@ -2,7 +2,7 @@ regcool.vm - 0.0.0.20240411 + 2.015 Kurt Zimmermann In addition to all the features that you can find in RegEdit and RegEdt32, RegCool adds many powerful features that allow you to work faster and more efficiently with registry related tasks diff --git a/packages/regcool.vm/tools/chocolateyinstall.ps1 b/packages/regcool.vm/tools/chocolateyinstall.ps1 index 210c23a50..015d91be3 100644 --- a/packages/regcool.vm/tools/chocolateyinstall.ps1 +++ b/packages/regcool.vm/tools/chocolateyinstall.ps1 @@ -3,38 +3,8 @@ Import-Module vm.common -Force -DisableNameChecking $toolName = 'RegCool' $category = 'Registry' -$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} $toolName $zipUrl = 'https://kurtzimmermann.com/files/RegCoolX64.zip' +$zipSha256 = '8fde37cf66024eb68be3c0e34125540f855626935f1cffc0fb7409f3ba343870' -try { - # Download zip - $packageArgs = @{ - packageName = $env:ChocolateyPackageName - file = Join-Path ${Env:TEMP} $toolName - url = $zipUrl - } - $filePath = Get-ChocolateyWebFile @packageArgs - - # Extract zip - Get-ChocolateyUnzip -FileFullPath $filePath -Destination $toolDir - - # Check signature of all unzip files - Get-ChildItem -Path "$toolDir\*.{exe,dll}" | ForEach-Object { - VM-Assert-Signature $_.FullName - } -} catch { - # Remove files with invalid signature - Remove-Item $toolDir -Recurse -Force -ea 0 | Out-Null - VM-Write-Log-Exception $_ -} - -try { - $shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category - $shortcut = Join-Path $shortcutDir "$toolname.lnk" - $toolPath = Join-Path $toolDir "$toolName.exe" - Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $toolPath - VM-Assert-Path $shortcut -} catch { - VM-Write-Log-Exception $_ -} +VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -consoleApp $false -innerFolder $false