From db702848ced824526bd2bc502f0a719b3b360cd8 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 21 May 2020 01:36:33 -0500 Subject: [PATCH] WIndows - update Install-Msys2.ps1 (#906) 1. Use Invoke-RestMethod to retrieve most recent msys2 base 2. Git tar - change paths to full nix style 3. Git tar - requires exe's from Git/mingw64/bin, set ENV 2 & 3 may not be needed, but if anything changes... --- images/win/scripts/Installers/Install-Msys2.ps1 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/images/win/scripts/Installers/Install-Msys2.ps1 b/images/win/scripts/Installers/Install-Msys2.ps1 index dcf41738..f91f6b3d 100644 --- a/images/win/scripts/Installers/Install-Msys2.ps1 +++ b/images/win/scripts/Installers/Install-Msys2.ps1 @@ -10,8 +10,11 @@ $origPath = $env:PATH $gitPath = "$env:ProgramFiles\Git" -# get info from https://sourceforge.net/projects/msys2/files/Base/x86_64/ -$msys2Uri = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz" +$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest" + +$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object { + $_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url + $msys2File = "$env:TEMP\msys2.tar.xz" # Download the latest msys2 x86_64 @@ -19,13 +22,17 @@ Write-Host "Starting msys2 download" (New-Object System.Net.WebClient).DownloadFile($msys2Uri, $msys2File) Write-Host "Finished download" -$msys2FileU = "/$msys2File".replace(':', '') +# nix style path for tar +$msys2FileU = "/$msys2File".replace(':', '').replace('\', '/') + +# Git tar needs exe's from mingw64\bin +$env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath" $tar = "$gitPath\usr\bin\tar.exe" # extract tar.xz to C:\ -Write-Host "Starting msys2 extraction" -&$tar -Jxf $msys2FileU -C /c/ +Write-Host "Starting msys2 extraction from $msys2FileU" +&$tar -xJf $msys2FileU -C /c/ Remove-Item $msys2File Write-Host "Finished extraction"