File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
images/win/scripts/Installers Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,21 @@ $origPath = $env:PATH
1212
1313function Install-Msys2 {
1414 $msys2_release = " https://api.github.com/repos/msys2/msys2-installer/releases/latest"
15- $msys2Uri = (( Invoke-RestMethod $msys2_release ).assets | Where-Object {
16- $_.name -match " ^msys2-x86_64" -and $_.name.EndsWith (" .exe" ) }).browser_download_url
17-
15+ $assets = (Invoke-RestMethod - Uri $msys2_release ).assets
16+ $msys2Uri = ( $assets | Where-Object { $_.name -match " ^msys2-x86_64" -and $_.name.EndsWith (" .exe" ) }).browser_download_url
17+
1818 # Download the latest msys2 x86_64, filename includes release date
1919 Write-Host " Starting msys2 download using $ ( $msys2Uri.split (' /' )[-1 ]) "
2020 $msys2File = Start-DownloadWithRetry - Url $msys2Uri
2121 Write-Host " Finished download"
2222
23+ # region Supply chain security - Kind
24+ $fileHash = (Get-FileHash - Path $msys2File - Algorithm SHA256).Hash
25+ $hashUrl = ($assets.browser_download_url -match " msys2-checksums.txt" ) | Select-Object - First 1
26+ $externalHash = (Invoke-RestMethod - Uri $hashURL ).ToString().Split(" `n " ).Where ({ $_ -ilike " *msys2-x86_64*" }).Split(' ' )[0 ]
27+ Use-ChecksumComparison $fileHash $externalHash
28+ # endregion
29+
2330 # extract tar.xz to C:\
2431 Write-Host " Starting msys2 installation"
2532 & $msys2File in -- confirm-command -- accept- messages -- root C:/ msys64
@@ -89,4 +96,4 @@ Install-MingwPackages -Packages $toolsetContent.mingw
8996$env: PATH = $origPath
9097Write-Host " `n MSYS2 installation completed"
9198
92- Invoke-PesterTests - TestFile " MSYS2"
99+ Invoke-PesterTests - TestFile " MSYS2"
You can’t perform that action at this time.
0 commit comments