Add validate spript

This commit is contained in:
Vladimir Safonkin
2020-03-17 11:07:29 +03:00
parent d4ef717e85
commit ab8fb88d95
3 changed files with 84 additions and 18 deletions

View File

@@ -139,12 +139,6 @@
"{{ template_dir }}/scripts/Installers/Update-ImageData.ps1" "{{ template_dir }}/scripts/Installers/Update-ImageData.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Windows2019/Install-Msys2.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"scripts":[ "scripts":[
@@ -470,6 +464,12 @@
"{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1" "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Install-Msys2.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"scripts":[ "scripts":[
@@ -604,6 +604,12 @@
"{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1" "{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1"
] ]
}, },
{
"type": "powershell",
"scripts":[
"{{ template_dir }}/scripts/Installers/Validate-Msys2.ps1"
]
},
{ {
"type": "powershell", "type": "powershell",
"environment_vars":[ "environment_vars":[

View File

@@ -11,11 +11,11 @@ $env:orig_path = $env:PATH
$env:git_path = "C:\Program Files\Git" $env:git_path = "C:\Program Files\Git"
# get info from https://sourceforge.net/projects/msys2/files/Base/x86_64/ # 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" $msy2_file = "C:\Windows\Temp\msys2.tar.xz"
# Download the latest msys2 x86_64 # 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) (New-Object System.Net.WebClient).DownloadFile($msy2_uri, $msy2_file)
Write-Host "Finished download" 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" $tar = "$env:git_path\usr\bin\tar.exe"
# extract tar.xz to C:\ # extract tar.xz to C:\
Write-Host "Starting extraction..." Write-Host "Starting extraction"
&$tar -Jxf $msy2_file_u -C /c/ &$tar -Jxf $msy2_file_u -C /c/
Remove-Item $msy2_file 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" $env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:orig_path"
Write-Host "bash.exe -c pacman-key --init" $ErrorActionPreference = "Continue"
bash.exe -c "pacman-key --init"
Write-Host "bash.exe -c pacman-key --populate msys2" Write-Host "sh -c pacman-key --init"
bash.exe -c "pacman-key --populate msys2" 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" Write-Host "pacman --noconfirm -Syyuu"
pacman.exe -Syyuu --noconfirm pacman.exe -Syyuu --noconfirm 2>$null
pacman.exe -Syuu --noconfirm 2>$null
# install msys2 packages # install msys2 packages
Write-Host "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" Write-Host "Clean packages"
pacman.exe -Scc --noconfirm pacman.exe -Scc --noconfirm
Write-Host
Write-Host "Installed mingw64 packages" Write-Host "Installed mingw64 packages"
pacman.exe -Qs --noconfirm mingw-w64-x86_64- pacman.exe -Qs --noconfirm mingw-w64-x86_64-
Write-Host
Write-Host "Installed mingw32 packages" Write-Host "Installed mingw32 packages"
pacman.exe -Qs --noconfirm mingw-w64-i686- pacman.exe -Qs --noconfirm mingw-w64-i686-
Write-Host
Write-Host "Installed msys2 packages" Write-Host "Installed msys2 packages"
pacman.exe -Qs --noconfirm pacman.exe -Qs --noconfirm
Write-Host "MSYS2 installation completed"
exit 0 exit 0

View File

@@ -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<br/>
_Environment:_
* PATH: contains location of the MinGW 'bin' directory
"@
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description