| 1 | # Functions used by the PowerShell scripts in this directory. |
| 2 | |
| 3 | #Requires -Version 4.0 |
| 4 | |
| 5 | function Get-MSYS2Prefix { |
| 6 | if (-Not ($msysprefix)) { |
| 7 | if (Test-Path -Path C:\msys64\usr\bin\bash.exe) { |
| 8 | return "C:\msys64" |
| 9 | } elseif ($env:ChocolateyToolsLocation) { |
| 10 | if (Test-Path -Path "$env:ChocolateyToolsLocation\msys64\usr\bin\bash.exe") { |
| 11 | Write-Host "Found MSYS2 installed via Chocolatey" |
| 12 | Write-Host "This will work for building Netdata, but not for packaging it" |
| 13 | return "$env:ChocolateyToolsLocation\msys64" |
| 14 | } |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | return "" |
| 19 | } |
| 20 | |
| 21 | function Get-MSYS2Bash { |
| 22 | $msysprefix = $args[0] |
| 23 | |
| 24 | if (-Not ($msysprefix)) { |
| 25 | $msysprefix = Get-MSYS2Prefix |
| 26 | } |
| 27 | |
| 28 | Write-Host "Using MSYS2 from $msysprefix" |
| 29 | |
| 30 | return "$msysprefix\usr\bin\bash.exe" |
| 31 | } |