Browse Source

Keep aws-iam-authenticator update from inadvertently packaging the .exe

Douglas Thrift 4 years ago
parent
commit
b64c0139b8
1 changed files with 10 additions and 4 deletions
  1. 10 4
      automatic/aws-iam-authenticator/update.ps1

+ 10 - 4
automatic/aws-iam-authenticator/update.ps1

@@ -4,12 +4,18 @@ $latest_release = 'https://github.com/kubernetes-sigs/aws-iam-authenticator/rele
 
 function global:au_GetLatest {
   $download_page = Invoke-WebRequest -Uri $latest_release -UseBasicParsing
-  $regex         = '^.+/aws-iam-authenticator_(\d+\.\d+\.\d+)_windows_amd64\.exe$'
-  $url64         = "https://github.com$($download_page.Links | ? href -Match $regex | select -First 1 -ExpandProperty href)"
-  $version       = $url64 -replace $regex, '$1'
+  $regex = '^.+/aws-iam-authenticator_(\d+\.\d+\.\d+)_windows_amd64\.exe$'
+  $url64 = "https://github.com$($download_page.Links | Where-Object href -Match $regex | Select-Object -First 1 -ExpandProperty href)"
+  $version = $url64 -replace $regex, '$1'
   return @{ Version = $version; URL64 = $url64 }
 }
 
+function global:au_BeforeUpdate() {
+  $algorithm = 'sha256'
+  $Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $algorithm
+  $Latest.ChecksumType64 = $algorithm
+}
+
 function global:au_SearchReplace {
   @{
     'tools\chocolateyInstall.ps1' = @{
@@ -20,4 +26,4 @@ function global:au_SearchReplace {
   }
 }
 
-update -ChecksumFor 64
+update -ChecksumFor none