diff --git a/images/win/scripts/Installers/Validate-Msys2.ps1 b/images/win/scripts/Installers/Validate-Msys2.ps1
index 187e219d..b8eac3aa 100644
--- a/images/win/scripts/Installers/Validate-Msys2.ps1
+++ b/images/win/scripts/Installers/Validate-Msys2.ps1
@@ -3,55 +3,44 @@
## 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
+$msys2BinDir = "C:\msys64\usr\bin"
+$msys2mingwDir = "C:\msys64\mingw64\bin"
+
+$installedTools = @(
+ "bash",
+ "tar",
+ "make"
+)
+
+Write-Host "Check installed tools in msys2/usr/bin directory"
+$installedTools | ForEach-Object {
+ $toolName = $_
+ try {
+ Invoke-Expression "$msys2BinDir\$_ --version"
+ } catch {
+ Write-Host "$toolName was not installed in MSYS2 bin directory"
+ Write-Error $_
+ 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"
+Write-Host "Check gcc in msys2/mingw64/bin directory"
+try {
+ Invoke-Expression "$msys2mingwDir\gcc --version"
+} catch {
+ Write-Host "gcc was not installed in MSYS2 bin directory"
+ Write-Error $_
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 = "MSYS2"
+# $(pacman.exe --version).Split([System.Environment]::NewLine)[1] -match "v\d+\.\d+\.\d+"
+# $pacmanVersion = $matches[0]
-$SoftwareName = "MinGW"
-$(gcc --version).Split([System.Environment]::NewLine)[0] -match "\d+\.\d+\.\d+$"
-$minGwVersion = $matches[0]
+# $Description = @"
+# _Pacman version:_ $pacmanVersion
+# "@
-$Description = @"
-_Version:_ $minGwVersion
-_Environment:_
-* PATH: contains location of the MinGW 'bin' directory
-"@
-
-Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
+# Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description