[Windows] Add shell symlinks (#2395)

* add shell symlinks

* fix paths

* add a wrapper

* fix target output

* fix tests
This commit is contained in:
Aleksandr Chebotov
2021-01-15 13:42:37 +03:00
committed by GitHub
parent da495ea119
commit 68e9c68855
7 changed files with 57 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
# Create shells folder
$shellPath = "C:\shells"
New-Item -Path $shellPath -ItemType Directory | Out-Null
# add a wrapper for C:\msys64\usr\bin\bash.exe
@'
@echo off
setlocal
IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=strict
IF NOT DEFINED MSYSTEM set MSYSTEM=mingw64
set CHERE_INVOKING=1
C:\msys64\usr\bin\bash.exe -leo pipefail %*
'@ | Out-File -FilePath "$shellPath\msys2bash.cmd"
# gitbash <--> C:\Program Files\Git\bin\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\gitbash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null
# WSL is available on Windows Server 2019
if (Test-IsWin19)
{
# wslbash <--> C:\Windows\System32\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\wslbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null
}