diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index eb574cec..a8623ef2 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -139,12 +139,6 @@ "{{ template_dir }}/scripts/Installers/Update-ImageData.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Windows2019/Install-Msys2.ps1" - ] - }, { "type": "powershell", "scripts":[ @@ -470,6 +464,12 @@ "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Msys2.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -604,6 +604,12 @@ "{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Msys2.ps1" + ] + }, { "type": "powershell", "environment_vars":[ diff --git a/images/win/scripts/Installers/Windows2019/Install-Msys2.ps1 b/images/win/scripts/Installers/Install-Msys2.ps1 similarity index 78% rename from images/win/scripts/Installers/Windows2019/Install-Msys2.ps1 rename to images/win/scripts/Installers/Install-Msys2.ps1 index 88c6b6ef..73d7b81d 100644 --- a/images/win/scripts/Installers/Windows2019/Install-Msys2.ps1 +++ b/images/win/scripts/Installers/Install-Msys2.ps1 @@ -11,11 +11,11 @@ $env:orig_path = $env:PATH $env:git_path = "C:\Program Files\Git" # get info from https://sourceforge.net/projects/msys2/files/Base/x86_64/ -$msy2_uri = "https://netix.dl.sourceforge.net/project/msys2/Base/x86_64/msys2-base-x86_64-20190524.tar.xz" +$msy2_uri = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz" $msy2_file = "C:\Windows\Temp\msys2.tar.xz" # Download the latest msys2 x86_64 -Write-Host "Starting msys2 download..." +Write-Host "Starting download" (New-Object System.Net.WebClient).DownloadFile($msy2_uri, $msy2_file) Write-Host "Finished download" @@ -26,22 +26,26 @@ $env:PATH = "$env:git_path\mingw64\bin;$env:orig_path" $tar = "$env:git_path\usr\bin\tar.exe" # extract tar.xz to C:\ -Write-Host "Starting extraction..." +Write-Host "Starting extraction" &$tar -Jxf $msy2_file_u -C /c/ Remove-Item $msy2_file -Write-Host "Finished extraction" +Write-Host Finished extraction $env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:orig_path" -Write-Host "bash.exe -c pacman-key --init" -bash.exe -c "pacman-key --init" +$ErrorActionPreference = "Continue" -Write-Host "bash.exe -c pacman-key --populate msys2" -bash.exe -c "pacman-key --populate msys2" +Write-Host "sh -c pacman-key --init" +Invoke-Expression "bash -c `"pacman-key --init 2>&1`"" + + +Write-Host "sh.exe -c pacman-key --populate msys2" +Invoke-Expression "sh -c `"pacman-key --populate msys2 2>&1`"" Write-Host "pacman --noconfirm -Syyuu" -pacman.exe -Syyuu --noconfirm +pacman.exe -Syyuu --noconfirm 2>$null +pacman.exe -Syuu --noconfirm 2>$null # install msys2 packages Write-Host "Install msys2 packages" @@ -64,16 +68,15 @@ pacman.exe -S --noconfirm --needed --noprogressbar $tools.replace('___', $pre).s Write-Host "Clean packages" pacman.exe -Scc --noconfirm -Write-Host Write-Host "Installed mingw64 packages" pacman.exe -Qs --noconfirm mingw-w64-x86_64- -Write-Host Write-Host "Installed mingw32 packages" pacman.exe -Qs --noconfirm mingw-w64-i686- -Write-Host Write-Host "Installed msys2 packages" pacman.exe -Qs --noconfirm +Write-Host "MSYS2 installation completed" + exit 0 \ No newline at end of file diff --git a/images/win/scripts/Installers/Validate-Msys2.ps1 b/images/win/scripts/Installers/Validate-Msys2.ps1 new file mode 100644 index 00000000..9b0492a3 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Msys2.ps1 @@ -0,0 +1,57 @@ +################################################################################ +## File: Validate-MSYS2.ps1 +## Desc: Validate MSYS2 +################################################################################ + +if (Get-Command -Name 'gcc') +{ + Write-Host "gcc is successfully installed:" + gcc --version | Write-Host +} +else +{ + Write-Host "gcc is not on PATH" + exit 1 +} + +if (Get-Command -Name 'g++') +{ + Write-Host "g++ is successfully installed:" + g++ --version | Write-Host +} +else +{ + Write-Host "g++ is not on PATH" + exit 1 +} + +if (Get-Command -Name 'make') +{ + Write-Host "make is successfully installed:" + make --version | Write-Host +} +else +{ + Write-Host "make is not on PATH" + exit 1 +} + +Adding description of the software to Markdown + +`gcc --version` gives output like: +gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.3.0 +Copyright (C) 2015 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +$SoftwareName = "MinGW" +$(gcc --version).Split([System.Environment]::NewLine)[0] -match "\d\.\d\.\d$" +$minGwVersion = $matches[0] + +$Description = @" +_Version:_ $minGwVersion
+_Environment:_ +* PATH: contains location of the MinGW 'bin' directory +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description