functions.ps1 858 B

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