2020-10-23 17:59:08 +03:00
|
|
|
#!/bin/bash -e -o pipefail
|
2023-11-28 02:25:03 +01:00
|
|
|
################################################################################
|
|
|
|
|
## File: install-common-utils.sh
|
|
|
|
|
## Desc: Install utils listed in toolset file
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2020-09-10 14:34:08 +03:00
|
|
|
source ~/utils/utils.sh
|
2020-09-21 09:46:17 +03:00
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
common_packages=$(get_toolset_value '.brew.common_packages[]')
|
|
|
|
|
for package in $common_packages; do
|
|
|
|
|
echo "Installing $package..."
|
2025-03-21 19:11:29 +01:00
|
|
|
case "$package" in
|
|
|
|
|
packer)
|
|
|
|
|
# Packer has been deprecated in Homebrew. Use tap to install Packer.
|
|
|
|
|
brew install hashicorp/tap/packer
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
kotlin)
|
|
|
|
|
# Pin kotlin bottle to 2.1.10 due to an issue with the latest version
|
|
|
|
|
# https://youtrack.jetbrains.com/issue/KT-76169/kotlinc-js-version-and-kapt-version-returning-non-zero-status-code-on-v2.1.20
|
|
|
|
|
kotlin_commit="442af88a2925f8c0e079eaf4fa62261133d2d7c4"
|
|
|
|
|
kotlin_rb_link="https://raw.githubusercontent.com/Homebrew/homebrew-core/$kotlin_commit/Formula/k/kotlin.rb"
|
|
|
|
|
kotlin_rb_path=$(download_with_retry "$kotlin_rb_link")
|
|
|
|
|
brew install "$kotlin_rb_path"
|
|
|
|
|
;;
|
|
|
|
|
|
2025-04-04 13:43:10 +02:00
|
|
|
cmake)
|
|
|
|
|
# Pin cmake bottle to 3.31.6 due to a backward compatibility issue with the latest version
|
|
|
|
|
# https://github.com/actions/runner-images/issues/11926
|
|
|
|
|
cmake_commit="b4e46db74e74a8c1650b38b1da222284ce1ec5ce"
|
|
|
|
|
cmake_rb_link="https://raw.githubusercontent.com/Homebrew/homebrew-core/$cmake_commit/Formula/c/cmake.rb"
|
|
|
|
|
cmake_rb_path=$(download_with_retry "$cmake_rb_link")
|
|
|
|
|
brew install "$cmake_rb_path"
|
|
|
|
|
;;
|
|
|
|
|
|
2025-03-21 19:11:29 +01:00
|
|
|
tcl-tk@8)
|
2025-01-27 14:09:51 +01:00
|
|
|
brew_smart_install "$package"
|
2025-03-21 19:11:29 +01:00
|
|
|
if is_VenturaX64 || is_SonomaX64; then
|
|
|
|
|
# Fix for https://github.com/actions/runner-images/issues/11074
|
|
|
|
|
ln -sf "$(brew --prefix tcl-tk@8)/lib/libtcl8.6.dylib" /usr/local/lib/libtcl8.6.dylib
|
|
|
|
|
ln -sf "$(brew --prefix tcl-tk@8)/lib/libtk8.6.dylib" /usr/local/lib/libtk8.6.dylib
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
# Default behaviour for all other packages
|
|
|
|
|
*)
|
2025-01-27 14:09:51 +01:00
|
|
|
brew_smart_install "$package"
|
2025-03-21 19:11:29 +01:00
|
|
|
;;
|
|
|
|
|
esac
|
2020-09-10 14:34:08 +03:00
|
|
|
done
|
|
|
|
|
|
2020-12-23 22:14:13 +07:00
|
|
|
cask_packages=$(get_toolset_value '.brew.cask_packages[]')
|
|
|
|
|
for package in $cask_packages; do
|
|
|
|
|
echo "Installing $package..."
|
2025-01-27 14:09:51 +01:00
|
|
|
if is_Arm64 && [[ $package == "parallels" ]]; then
|
|
|
|
|
echo "Parallels installation is skipped for arm64 architecture"
|
2023-11-06 11:53:10 +01:00
|
|
|
else
|
2025-01-27 14:09:51 +01:00
|
|
|
brew install --cask $package
|
2023-11-06 11:53:10 +01:00
|
|
|
fi
|
2020-09-10 14:34:08 +03:00
|
|
|
done
|
|
|
|
|
|
2022-09-28 19:06:08 +02:00
|
|
|
# Load "Parallels International GmbH"
|
2025-03-11 20:56:27 +05:30
|
|
|
if is_SonomaX64 || is_VenturaX64 || is_SequoiaX64; then
|
2022-09-28 19:06:08 +02:00
|
|
|
sudo kextload /Applications/Parallels\ Desktop.app/Contents/Library/Extensions/10.9/prl_hypervisor.kext || true
|
|
|
|
|
fi
|
|
|
|
|
|
2025-03-11 20:56:27 +05:30
|
|
|
# Execute AppleScript to change security preferences for macOS12, macOS13, macOS14 and macOS15
|
2022-05-24 23:48:57 +04:00
|
|
|
# System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
|
2025-03-11 20:56:27 +05:30
|
|
|
if is_SonomaX64 || is_VenturaX64 || is_SequoiaX64; then
|
2024-08-09 11:25:15 +02:00
|
|
|
for retry in {4..0}; do
|
|
|
|
|
echo "Executing AppleScript to change security preferences. Retries left: $retry"
|
|
|
|
|
{
|
|
|
|
|
set -e
|
|
|
|
|
osascript -e 'tell application "System Events" to get application processes where visible is true'
|
2024-08-19 06:57:44 -07:00
|
|
|
if is_VenturaX64; then
|
|
|
|
|
osascript $HOME/utils/confirm-identified-developers-macos13.scpt $USER_PASSWORD
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if is_SonomaX64; then
|
|
|
|
|
osascript $HOME/utils/confirm-identified-developers-macos14.scpt $USER_PASSWORD
|
|
|
|
|
fi
|
2025-03-11 20:56:27 +05:30
|
|
|
if is_SequoiaX64; then
|
|
|
|
|
osascript $HOME/utils/confirm-identified-developers-macos15.scpt $USER_PASSWORD
|
|
|
|
|
fi
|
2024-08-09 11:25:15 +02:00
|
|
|
} && break
|
2023-03-02 11:21:19 +01:00
|
|
|
|
2024-08-09 11:25:15 +02:00
|
|
|
if [[ $retry -eq 0 ]]; then
|
|
|
|
|
echo "Executing AppleScript failed. No retries left"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2023-10-27 09:32:43 +02:00
|
|
|
|
2024-08-09 11:25:15 +02:00
|
|
|
echo "Executing AppleScript failed. Sleeping for 10 seconds and retrying"
|
|
|
|
|
sleep 10
|
|
|
|
|
done
|
2022-05-24 23:48:57 +04:00
|
|
|
fi
|
|
|
|
|
|
2022-09-28 19:06:08 +02:00
|
|
|
# Validate "Parallels International GmbH" kext
|
2025-03-11 20:56:27 +05:30
|
|
|
if is_SonomaX64 || is_VenturaX64 || is_SequoiaX64; then
|
2024-08-19 06:57:44 -07:00
|
|
|
|
2025-01-27 14:09:51 +01:00
|
|
|
echo "Closing System Settings window if it is still opened"
|
|
|
|
|
killall "System Settings" || true
|
2022-09-29 21:58:02 +02:00
|
|
|
|
|
|
|
|
echo "Checking parallels kexts"
|
2022-09-28 19:06:08 +02:00
|
|
|
dbName="/var/db/SystemPolicyConfiguration/KextPolicy"
|
|
|
|
|
dbQuery="SELECT * FROM kext_policy WHERE bundle_id LIKE 'com.parallels.kext.%';"
|
|
|
|
|
kext=$(sudo sqlite3 $dbName "$dbQuery")
|
|
|
|
|
|
2024-01-09 14:47:31 +01:00
|
|
|
if [[ -z $kext ]]; then
|
2022-09-28 19:06:08 +02:00
|
|
|
echo "Parallels International GmbH not found"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Create env variable
|
|
|
|
|
url=$(brew info --json=v2 --installed | jq -r '.casks[] | select(.name[] == "Parallels Desktop").url')
|
2024-01-09 14:47:31 +01:00
|
|
|
if [[ -z $url ]]; then
|
2022-09-28 19:06:08 +02:00
|
|
|
echo "Unable to parse url for Parallels Desktop cask"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2024-01-09 14:47:31 +01:00
|
|
|
echo "export PARALLELS_DMG_URL=$url" >> ${HOME}/.bashrc
|
2022-09-28 19:06:08 +02:00
|
|
|
fi
|
|
|
|
|
|
2024-08-09 11:25:15 +02:00
|
|
|
# Install Azure DevOps extension for Azure Command Line Interface
|
|
|
|
|
az extension add -n azure-devops
|
2022-02-11 12:53:36 +03:00
|
|
|
|
2021-01-29 16:37:48 +07:00
|
|
|
# Invoke tests for all basic tools
|
|
|
|
|
invoke_tests "BasicTools"
|