From 3f05ba0dba6724d6c84eec579d9c10b58212a217 Mon Sep 17 00:00:00 2001 From: Vladimir Safonkin Date: Thu, 19 Mar 2020 09:24:11 +0300 Subject: [PATCH] Add msys2 to windows-2016 --- images/win/Windows2016-Azure.json | 14 ++++++++++++++ images/win/scripts/Installers/Install-Msys2.ps1 | 14 ++++++-------- images/win/scripts/Installers/Validate-Msys2.ps1 | 10 +++++----- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 94f200b0..df3aa473 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -483,6 +483,14 @@ "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1" ] }, + { + "type": "powershell", + "elevated_user": "SYSTEM", + "elevated_password": "", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Msys2.ps1" + ] + }, { "type": "powershell", "scripts":[ @@ -611,6 +619,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/Install-Msys2.ps1 b/images/win/scripts/Installers/Install-Msys2.ps1 index 73d7b81d..62195aaa 100644 --- a/images/win/scripts/Installers/Install-Msys2.ps1 +++ b/images/win/scripts/Installers/Install-Msys2.ps1 @@ -15,7 +15,7 @@ $msy2_uri = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.ta $msy2_file = "C:\Windows\Temp\msys2.tar.xz" # Download the latest msys2 x86_64 -Write-Host "Starting download" +Write-Host "Starting msys2 download" (New-Object System.Net.WebClient).DownloadFile($msy2_uri, $msy2_file) Write-Host "Finished download" @@ -26,22 +26,20 @@ $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 msys2 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" $ErrorActionPreference = "Continue" -Write-Host "sh -c pacman-key --init" +Write-Host "bash -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 "bash -c pacman-key --populate msys2" +Invoke-Expression "bash -c `"pacman-key --populate msys2 2>&1`"" Write-Host "pacman --noconfirm -Syyuu" pacman.exe -Syyuu --noconfirm 2>$null diff --git a/images/win/scripts/Installers/Validate-Msys2.ps1 b/images/win/scripts/Installers/Validate-Msys2.ps1 index 9b0492a3..31c8ea88 100644 --- a/images/win/scripts/Installers/Validate-Msys2.ps1 +++ b/images/win/scripts/Installers/Validate-Msys2.ps1 @@ -38,11 +38,11 @@ else 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. +# `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$"