[macOS] Rework PowerShell installation (#4778)

This commit is contained in:
Dibir Magomedsaygitov
2021-12-22 10:38:22 +03:00
committed by GitHub
parent d8cbcdfd38
commit cfacab19e6

View File

@@ -2,7 +2,16 @@
source ~/utils/utils.sh
echo Installing PowerShell...
brew install --cask powershell
psRelease=$(curl -s "https://api.github.com/repos/PowerShell/PowerShell/releases/latest")
psDownloadUrl=$(echo $psRelease | jq -r '.assets[].browser_download_url | select(contains("osx-x64.pkg"))' | head -n 1)
download_with_retries $psDownloadUrl "/tmp" "powershell.pkg"
# Work around the issue on macOS Big Sur 11.5 or higher for possible error message ("can't be opened because Apple cannot check it for malicious software") when installing the package
if ! is_Less_BigSur; then
sudo xattr -rd com.apple.quarantine /tmp/powershell.pkg
fi
sudo installer -pkg /tmp/powershell.pkg -target /
# Install PowerShell modules
psModules=$(get_toolset_value '.powershellModules[].name')