scripts: 'pwsh' now uses a more reliable path and fallback
This commit is contained in:
parent
c96fc7bbcb
commit
bf3e86a5df
1 changed files with 5 additions and 10 deletions
|
@ -3,19 +3,14 @@
|
|||
env-share 2> /dev/null
|
||||
|
||||
# try to use system-wide version first.
|
||||
# this usually fails, but it's worth a shot.
|
||||
if [[ -r '/mnt/c/Program Files/WindowsApps/' ]]; then
|
||||
cd '/mnt/c/Program Files/WindowsApps/'
|
||||
PWSH="`pwd`/`find Microsoft.PowerShell_* -name 'pwsh.exe'`"
|
||||
cd - > /dev/null
|
||||
if ! [ -x "$PWSH" ]; then
|
||||
PWSH='/mnt/c/Program Files/PowerShell/7/pwsh.exe'
|
||||
if [ -x "$PWSH" ]; then
|
||||
unset PWSH
|
||||
fi
|
||||
fi
|
||||
|
||||
# fall back to user installation
|
||||
# fall back to System32
|
||||
if [ -z ${PWSH+x} ]; then
|
||||
PWSH="`dos-var -p USERPROFILE`/AppData/Local/Microsoft/WindowsApps/pwsh.exe"
|
||||
PWSH='/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
|
||||
fi
|
||||
|
||||
# run target
|
||||
|
|
Loading…
Reference in a new issue