diff --git a/AU/Public/Update-Package.ps1 b/AU/Public/Update-Package.ps1 index da05962..da4c200 100644 --- a/AU/Public/Update-Package.ps1 +++ b/AU/Public/Update-Package.ps1 @@ -129,12 +129,13 @@ function Update-Package { $Env:ChocolateyPackageVersion = $global:Latest.Version.ToString() $Env:ChocolateyAllowEmptyChecksums = 'true' foreach ($a in $arch) { + "Checking hash for $a bit version..." | result $Env:chocolateyForceX86 = if ($a -eq '32') { 'true' } else { '' } try { #rm -force -recurse -ea ignore $pkg_path .\tools\chocolateyInstall.ps1 | result } catch { - if ( "$_" -notlike 'au_break: *') { throw $_ } else { + if ( "$_" -notlike 'au_break: *') { throw } else { $filePath = "$_" -replace 'au_break: ' if (!(Test-Path $filePath)) { throw "Can't find file path to checksum" } @@ -153,6 +154,10 @@ function Update-Package { } } } + # Sanity check: ensure checksum is defined (rare bug!) + if (!$global:Latest.Item('Checksum' + $a)) { + throw "Hash for $a bit version is missing." + } } }