mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 20:26:49 +00:00
[macOS] refactor utils.sh and related scripts (#8998)
* Update Software Report to support azcopy output * Update util.sh and related scripts * Remove rosetta test from the script * Update mono script * clean up * remove condition from install pipx script * Update scripts according to comments --------- Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
This commit is contained in:
@@ -7,9 +7,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
echo "Enabling automatic GUI login for the '$USERNAME' user.."
|
echo "Enabling automatic GUI login for the '$USERNAME' user.."
|
||||||
|
|
||||||
python3 $HOME/bootstrap/kcpassword.py "$PASSWORD"
|
python3 $HOME/bootstrap/kcpassword.py "$PASSWORD"
|
||||||
|
|
||||||
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
|
/usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME"
|
||||||
|
|
||||||
: '
|
: '
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ defaults write com.apple.VoiceOver4/default SCREnableAppleScript -bool YES
|
|||||||
|
|
||||||
swiftc -suppress-warnings "${HOME}/image-generation/add-certificate.swift"
|
swiftc -suppress-warnings "${HOME}/image-generation/add-certificate.swift"
|
||||||
|
|
||||||
|
|
||||||
certs=(
|
certs=(
|
||||||
AppleWWDRCAG3.cer
|
AppleWWDRCAG3.cer
|
||||||
DeveloperIDG2CA.cer
|
DeveloperIDG2CA.cer
|
||||||
@@ -52,9 +51,7 @@ for cert in ${certs[@]}; do
|
|||||||
echo "Adding ${cert} certificate"
|
echo "Adding ${cert} certificate"
|
||||||
cert_path="${HOME}/${cert}"
|
cert_path="${HOME}/${cert}"
|
||||||
curl -fsSL "https://www.apple.com/certificateauthority/${cert}" --output ${cert_path}
|
curl -fsSL "https://www.apple.com/certificateauthority/${cert}" --output ${cert_path}
|
||||||
|
|
||||||
sudo ./add-certificate ${cert_path}
|
sudo ./add-certificate ${cert_path}
|
||||||
|
|
||||||
rm ${cert_path}
|
rm ${cert_path}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -41,5 +41,4 @@ echo "limit.maxfiles.plist permissions changing"
|
|||||||
chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist"
|
chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist"
|
||||||
chmod 0644 "${Launch_Daemons}/limit.maxfiles.plist"
|
chmod 0644 "${Launch_Daemons}/limit.maxfiles.plist"
|
||||||
|
|
||||||
|
|
||||||
echo "Done, limit.maxfiles has been updated"
|
echo "Done, limit.maxfiles has been updated"
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ EOF
|
|||||||
/bin/chmod 644 "${PLIST}"
|
/bin/chmod 644 "${PLIST}"
|
||||||
/usr/sbin/chown root:wheel "${PLIST}"
|
/usr/sbin/chown root:wheel "${PLIST}"
|
||||||
|
|
||||||
|
|
||||||
: '
|
: '
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
Copyright (c) 2013-2017 Timothy Sutton
|
Copyright (c) 2013-2017 Timothy Sutton
|
||||||
|
|||||||
@@ -13,11 +13,10 @@ if is_Arm64; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
retry=10
|
retry=10
|
||||||
while [ $retry -gt 0 ]; do
|
while [[ $retry -gt 0 ]]; do
|
||||||
openwindows=$(osascript -e 'tell application "System Events" to get every window of (every process whose class of windows contains window)') && break
|
openwindows=$(osascript -e 'tell application "System Events" to get every window of (every process whose class of windows contains window)') && break
|
||||||
|
|
||||||
retry=$((retry-1))
|
retry=$((retry-1))
|
||||||
if [ $retry -eq 0 ]; then
|
if [[ $retry -eq 0 ]]; then
|
||||||
echo "No retry attempts left"
|
echo "No retry attempts left"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
source ~/utils/utils.sh
|
source ~/utils/utils.sh
|
||||||
|
|
||||||
XCODE_LIST=($(get_toolset_value '.xcode.versions | reverse | .[].link'))
|
XCODE_LIST=($(get_toolset_value '.xcode.versions | reverse | .[].link'))
|
||||||
DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default')
|
DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default')
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if [ ! -d $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE ]; then
|
|||||||
mkdir -p $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
|
mkdir -p $ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
download_url=$(get_github_package_download_url "actions/action-versions" "contains(\"action-versions.tar.gz\")" "latest")
|
download_url=$(resolve_github_release_asset_url "actions/action-versions" "contains(\"action-versions.tar.gz\")" "latest")
|
||||||
echo "Downloading action-versions $download_url"
|
echo "Downloading action-versions $download_url"
|
||||||
archive_path=$(download_with_retry "$download_url")
|
archive_path=$(download_with_retry "$download_url")
|
||||||
tar -xzf "$archive_path" -C "$ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE"
|
tar -xzf "$archive_path" -C "$ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE"
|
||||||
|
|||||||
@@ -11,40 +11,40 @@ echo "Installing Google Chrome..."
|
|||||||
brew install --cask google-chrome
|
brew install --cask google-chrome
|
||||||
|
|
||||||
# Parse Google Chrome version
|
# Parse Google Chrome version
|
||||||
FULL_CHROME_VERSION=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
|
full_chrome_version=$("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --version)
|
||||||
FULL_CHROME_VERSION=${FULL_CHROME_VERSION#Google Chrome }
|
full_chrome_version=${full_chrome_version#Google Chrome }
|
||||||
CHROME_VERSION=${FULL_CHROME_VERSION%.*}
|
chrome_version=${full_chrome_version%.*}
|
||||||
echo "Google Chrome version is $FULL_CHROME_VERSION"
|
echo "Google Chrome version is $full_chrome_version"
|
||||||
|
|
||||||
# Get Google Chrome versions information
|
# Get Google Chrome versions information
|
||||||
CHROME_PLATFORM="mac-$arch"
|
chrome_platform="mac-$arch"
|
||||||
CHROME_VERSIONS_URL="https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json"
|
CHROME_VERSIONS_URL="https://googlechromelabs.github.io/chrome-for-testing/latest-patch-versions-per-build-with-downloads.json"
|
||||||
CHROME_VERSIONS_JSON="$(cat "$(download_with_retry "$CHROME_VERSIONS_URL")")"
|
chrome_versions_json="$(cat "$(download_with_retry "$CHROME_VERSIONS_URL")")"
|
||||||
|
|
||||||
# Download and unpack the latest release of Chrome Driver
|
# Download and unpack the latest release of Chrome Driver
|
||||||
CHROMEDRIVER_VERSION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].version')
|
chromedriver_version=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].version')
|
||||||
echo "Installing Chrome Driver version $CHROMEDRIVER_VERSION"
|
echo "Installing Chrome Driver version $chromedriver_version"
|
||||||
|
|
||||||
CHROMEDRIVER_URL=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].downloads.chromedriver[] | select(.platform=="'"${CHROME_PLATFORM}"'").url')
|
chromedriver_url=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].downloads.chromedriver[] | select(.platform=="'"${chrome_platform}"'").url')
|
||||||
CHROMEDRIVER_DIR="/usr/local/share/chromedriver-${CHROME_PLATFORM}"
|
chromedriver_dir="/usr/local/share/chromedriver-${chrome_platform}"
|
||||||
CHROMEDRIVER_BIN="$CHROMEDRIVER_DIR/chromedriver"
|
chromedriver_bin="$chromedriver_dir/chromedriver"
|
||||||
|
|
||||||
CHROMEDRIVER_ARCHIVE_PATH=$(download_with_retry "$CHROMEDRIVER_URL")
|
chromedriver_archive_path=$(download_with_retry "$chromedriver_url")
|
||||||
unzip -qq "$CHROMEDRIVER_ARCHIVE_PATH" -d /tmp/
|
unzip -qq "$chromedriver_archive_path" -d /tmp/
|
||||||
sudo mv "/tmp/chromedriver-${CHROME_PLATFORM}" "$CHROMEDRIVER_DIR"
|
sudo mv "/tmp/chromedriver-${chrome_platform}" "$chromedriver_dir"
|
||||||
ln -s "$CHROMEDRIVER_BIN" /usr/local/bin/chromedriver
|
ln -s "$chromedriver_bin" /usr/local/bin/chromedriver
|
||||||
echo "export CHROMEWEBDRIVER=$CHROMEDRIVER_DIR" >> "${HOME}/.bashrc"
|
echo "export CHROMEWEBDRIVER=$chromedriver_dir" >> "${HOME}/.bashrc"
|
||||||
|
|
||||||
# Download and unpack the latest release of Google Chrome for Testing
|
# Download and unpack the latest release of Google Chrome for Testing
|
||||||
CHROME_FOR_TESTING_VERSION=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].version')
|
chrome_for_testing_version=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].version')
|
||||||
echo "Installing Google Chrome for Testing version $CHROME_FOR_TESTING_VERSION"
|
echo "Installing Google Chrome for Testing version $chrome_for_testing_version"
|
||||||
|
|
||||||
CHROME_FOR_TESTING_URL=$(echo "${CHROME_VERSIONS_JSON}" | jq -r '.builds["'"$CHROME_VERSION"'"].downloads.chrome[] | select(.platform=="'"${CHROME_PLATFORM}"'").url')
|
chrome_for_testing_url=$(echo "${chrome_versions_json}" | jq -r '.builds["'"$chrome_version"'"].downloads.chrome[] | select(.platform=="'"${chrome_platform}"'").url')
|
||||||
CHROME_FOR_TESTING_APP="Google Chrome for Testing.app"
|
chrome_for_testing_app="Google Chrome for Testing.app"
|
||||||
|
|
||||||
CHROME_FOR_TESTING_ARCHIVE_PATH=$(download_with_retry "$CHROME_FOR_TESTING_URL")
|
chrome_for_testing_archive_path=$(download_with_retry "$chrome_for_testing_url")
|
||||||
unzip -qq "$CHROME_FOR_TESTING_ARCHIVE_PATH" -d /tmp/
|
unzip -qq "$chrome_for_testing_archive_path" -d /tmp/
|
||||||
mv "/tmp/chrome-${CHROME_PLATFORM}/${CHROME_FOR_TESTING_APP}" "/Applications/${CHROME_FOR_TESTING_APP}"
|
mv "/tmp/chrome-${chrome_platform}/${chrome_for_testing_app}" "/Applications/${chrome_for_testing_app}"
|
||||||
|
|
||||||
echo "Installing Selenium"
|
echo "Installing Selenium"
|
||||||
brew_smart_install "selenium-server"
|
brew_smart_install "selenium-server"
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ if is_Monterey; then
|
|||||||
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
|
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
|
||||||
} && break
|
} && break
|
||||||
|
|
||||||
if [ "$retry" -eq 0 ]; then
|
if [[ "$retry" -eq 0 ]]; then
|
||||||
echo "Executing AppleScript failed. No retries left"
|
echo "Executing AppleScript failed. No retries left"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -75,14 +75,14 @@ if is_Monterey; then
|
|||||||
dbQuery="SELECT * FROM kext_policy WHERE bundle_id LIKE 'com.parallels.kext.%';"
|
dbQuery="SELECT * FROM kext_policy WHERE bundle_id LIKE 'com.parallels.kext.%';"
|
||||||
kext=$(sudo sqlite3 $dbName "$dbQuery")
|
kext=$(sudo sqlite3 $dbName "$dbQuery")
|
||||||
|
|
||||||
if [ -z "$kext" ]; then
|
if [[ -z "$kext" ]]; then
|
||||||
echo "Parallels International GmbH not found"
|
echo "Parallels International GmbH not found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create env variable
|
# Create env variable
|
||||||
url=$(brew info --json=v2 --installed | jq -r '.casks[] | select(.name[] == "Parallels Desktop").url')
|
url=$(brew info --json=v2 --installed | jq -r '.casks[] | select(.name[] == "Parallels Desktop").url')
|
||||||
if [ -z "$url" ]; then
|
if [[ -z "$url" ]]; then
|
||||||
echo "Unable to parse url for Parallels Desktop cask"
|
echo "Unable to parse url for Parallels Desktop cask"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -15,21 +15,21 @@ DOTNET_INSTALL_SCRIPT="https://dot.net/v1/dotnet-install.sh"
|
|||||||
install_script_path=$(download_with_retry $DOTNET_INSTALL_SCRIPT)
|
install_script_path=$(download_with_retry $DOTNET_INSTALL_SCRIPT)
|
||||||
chmod +x "$install_script_path"
|
chmod +x "$install_script_path"
|
||||||
|
|
||||||
ARGS_LIST=()
|
args_list=()
|
||||||
echo "Parsing dotnet SDK (except rc and preview versions) from .json..."
|
echo "Parsing dotnet SDK (except rc and preview versions) from .json..."
|
||||||
|
|
||||||
DOTNET_VERSIONS=($(get_toolset_value ".dotnet.arch[\"$arch\"].versions | .[]"))
|
dotnet_versions=($(get_toolset_value ".dotnet.arch[\"$arch\"].versions | .[]"))
|
||||||
|
|
||||||
for DOTNET_VERSION in "${DOTNET_VERSIONS[@]}"; do
|
for dotnet_version in "${dotnet_versions[@]}"; do
|
||||||
RELEASE_URL="https://raw.githubusercontent.com/dotnet/core/main/release-notes/${DOTNET_VERSION}/releases.json"
|
release_url="https://raw.githubusercontent.com/dotnet/core/main/release-notes/${dotnet_version}/releases.json"
|
||||||
releases_json_file=$(download_with_retry "$RELEASE_URL")
|
releases_json_file=$(download_with_retry "$release_url")
|
||||||
|
|
||||||
if [[ $DOTNET_VERSION == "6.0" ]]; then
|
if [[ $dotnet_version == "6.0" ]]; then
|
||||||
ARGS_LIST+=(
|
args_list+=(
|
||||||
$(cat "$releases_json_file" | jq -r 'first(.releases[].sdks[]?.version | select(contains("preview") or contains("rc") | not))')
|
$(cat "$releases_json_file" | jq -r 'first(.releases[].sdks[]?.version | select(contains("preview") or contains("rc") | not))')
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
ARGS_LIST+=(
|
args_list+=(
|
||||||
$(cat "$releases_json_file" | \
|
$(cat "$releases_json_file" | \
|
||||||
jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*' | \
|
jq -r '.releases[].sdk."version"' | grep -v -E '\-(preview|rc)\d*' | \
|
||||||
sort -r | rev | uniq -s 2 | rev)
|
sort -r | rev | uniq -s 2 | rev)
|
||||||
@@ -37,7 +37,7 @@ for DOTNET_VERSION in "${DOTNET_VERSIONS[@]}"; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ARGS in "${ARGS_LIST[@]}"; do
|
for ARGS in "${args_list[@]}"; do
|
||||||
"$install_script_path" --version $ARGS -NoPath --arch $arch
|
"$install_script_path" --version $ARGS -NoPath --arch $arch
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -10,27 +10,27 @@ echo "Installing Microsoft Edge..."
|
|||||||
brew install --cask microsoft-edge
|
brew install --cask microsoft-edge
|
||||||
|
|
||||||
EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
|
EDGE_INSTALLATION_PATH="/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
|
||||||
EDGE_VERSION=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3)
|
edge_version=$("$EDGE_INSTALLATION_PATH" --version | cut -d' ' -f 3)
|
||||||
EDGE_VERSION_MAJOR=$(echo $EDGE_VERSION | cut -d'.' -f 1)
|
edge_version_major=$(echo $edge_version | cut -d'.' -f 1)
|
||||||
|
|
||||||
echo "Version of Microsoft Edge: ${EDGE_VERSION}"
|
echo "Version of Microsoft Edge: ${edge_version}"
|
||||||
|
|
||||||
echo "Installing Microsoft Edge WebDriver..."
|
echo "Installing Microsoft Edge WebDriver..."
|
||||||
|
|
||||||
EDGE_DRIVER_VERSION_FILE_PATH=$(download_with_retry "https://msedgedriver.azureedge.net/LATEST_RELEASE_${EDGE_VERSION_MAJOR}_MACOS")
|
edge_driver_version_file_path=$(download_with_retry "https://msedgedriver.azureedge.net/LATEST_RELEASE_${edge_version_major}_MACOS")
|
||||||
EDGE_DRIVER_LATEST_VERSION=$(iconv -f utf-16 -t utf-8 "$EDGE_DRIVER_VERSION_FILE_PATH" | tr -d '\r')
|
edge_driver_latest_version=$(iconv -f utf-16 -t utf-8 "$edge_driver_version_file_path" | tr -d '\r')
|
||||||
EDGE_DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_DRIVER_LATEST_VERSION}/edgedriver_mac64.zip"
|
edge_driver_url="https://msedgedriver.azureedge.net/${edge_driver_latest_version}/edgedriver_mac64.zip"
|
||||||
|
|
||||||
echo "Compatible version of WebDriver: ${EDGE_DRIVER_LATEST_VERSION}"
|
echo "Compatible version of WebDriver: ${edge_driver_latest_version}"
|
||||||
|
|
||||||
EDGE_DRIVER_ARCHIVE_PATH=$(download_with_retry "$EDGE_DRIVER_URL")
|
edge_driver_archive_path=$(download_with_retry "$edge_driver_url")
|
||||||
|
|
||||||
# Move webdriver to the separate directory to be consistent with the docs
|
# Move webdriver to the separate directory to be consistent with the docs
|
||||||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app
|
# https://docs.microsoft.com/en-us/azure/devops/pipelines/test/continuous-test-selenium?view=azure-devops#decide-how-you-will-deploy-and-test-your-app
|
||||||
|
|
||||||
EDGE_DRIVER_DIR="/usr/local/share/edge_driver"
|
EDGE_DRIVER_DIR="/usr/local/share/edge_driver"
|
||||||
mkdir -p $EDGE_DRIVER_DIR
|
mkdir -p $EDGE_DRIVER_DIR
|
||||||
unzip -qq "$EDGE_DRIVER_ARCHIVE_PATH" -d "$EDGE_DRIVER_DIR"
|
unzip -qq "$edge_driver_archive_path" -d "$EDGE_DRIVER_DIR"
|
||||||
ln -s "$EDGE_DRIVER_DIR/msedgedriver" "/usr/local/bin/msedgedriver"
|
ln -s "$EDGE_DRIVER_DIR/msedgedriver" "/usr/local/bin/msedgedriver"
|
||||||
|
|
||||||
echo "export EDGEWEBDRIVER=${EDGE_DRIVER_DIR}" >> "${HOME}/.bashrc"
|
echo "export EDGEWEBDRIVER=${EDGE_DRIVER_DIR}" >> "${HOME}/.bashrc"
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
source ~/utils/utils.sh
|
source ~/utils/utils.sh
|
||||||
|
|
||||||
DEFAULT_GO_VERSION=$(get_toolset_value '.go.default')
|
default_go_version=$(get_toolset_value '.go.default')
|
||||||
echo "Installing Go..."
|
echo "Installing Go..."
|
||||||
brew_smart_install "go@${DEFAULT_GO_VERSION}"
|
brew_smart_install "go@${default_go_version}"
|
||||||
|
|
||||||
# Create symlinks to preserve backward compatibility. Symlinks are not created when non-latest go is being installed
|
# Create symlinks to preserve backward compatibility. Symlinks are not created when non-latest go is being installed
|
||||||
ln -sf $(brew --prefix go@${DEFAULT_GO_VERSION})/bin/* /usr/local/bin/
|
ln -sf $(brew --prefix go@${default_go_version})/bin/* /usr/local/bin/
|
||||||
|
|
||||||
invoke_tests "Common" "Go"
|
invoke_tests "Common" "Go"
|
||||||
|
|||||||
@@ -4,50 +4,48 @@
|
|||||||
## Desc: Install Mono Framework
|
## Desc: Install Mono Framework
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Source utility functions
|
|
||||||
source ~/utils/utils.sh
|
source ~/utils/utils.sh
|
||||||
|
|
||||||
# Install Mono Framework
|
# Install Mono Framework
|
||||||
MONO_VERSION_FULL=$(get_toolset_value '.mono.framework.version')
|
mono_version_full=$(get_toolset_value '.mono.framework.version')
|
||||||
MONO_PKG_SHA256=$(get_toolset_value '.mono.framework.sha256')
|
mono_pkg_sha256=$(get_toolset_value '.mono.framework.sha256')
|
||||||
MONO_VERSION=$(echo "$MONO_VERSION_FULL" | cut -d. -f 1,2,3)
|
mono_version=$(echo "$mono_version_full" | cut -d. -f 1,2,3)
|
||||||
MONO_VERSION_SHORT=$(echo $MONO_VERSION_FULL | cut -d. -f 1,2)
|
mono_version_short=$(echo $mono_version_full | cut -d. -f 1,2)
|
||||||
MONO_PKG_URL="https://download.mono-project.com/archive/${MONO_VERSION}/macos-10-universal/MonoFramework-MDK-${MONO_VERSION_FULL}.macos10.xamarin.universal.pkg"
|
mono_pkg_url="https://download.mono-project.com/archive/${mono_version}/macos-10-universal/MonoFramework-MDK-${mono_version_full}.macos10.xamarin.universal.pkg"
|
||||||
MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions'
|
MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions'
|
||||||
|
|
||||||
MONO_PKG_PATH=$(download_with_retry "$MONO_PKG_URL")
|
mono_pkg_path=$(download_with_retry "$mono_pkg_url")
|
||||||
use_checksum_comparison "$MONO_PKG_PATH" "$MONO_PKG_SHA256"
|
use_checksum_comparison "$mono_pkg_path" "$mono_pkg_sha256"
|
||||||
|
echo "Installing Mono Framework ${mono_version_full}..."
|
||||||
echo "Installing Mono Framework ${MONO_VERSION_FULL}..."
|
sudo installer -pkg "$mono_pkg_path" -target /
|
||||||
sudo installer -pkg "$MONO_PKG_PATH" -target /
|
|
||||||
|
|
||||||
# Download and install NUnit console
|
# Download and install NUnit console
|
||||||
NUNIT_VERSION=$(get_toolset_value '.mono.nunit.version')
|
nunit_version=$(get_toolset_value '.mono.nunit.version')
|
||||||
NUNIT_ARCHIVE_URL="https://github.com/nunit/nunit-console/releases/download/${NUNIT_VERSION}/NUnit.Console-${NUNIT_VERSION}.zip"
|
nunit_archive_url="https://github.com/nunit/nunit-console/releases/download/${nunit_version}/NUnit.Console-${nunit_version}.zip"
|
||||||
NUNIT_ARCHIVE_SHA256=$(get_toolset_value '.mono.nunit.sha256')
|
nunit_archive_sha256=$(get_toolset_value '.mono.nunit.sha256')
|
||||||
NUNIT_PATH="/Library/Developer/nunit"
|
NUNIT_PATH="/Library/Developer/nunit"
|
||||||
NUNIT_VERSION_PATH="$NUNIT_PATH/$NUNIT_VERSION"
|
nunit_version_path="$NUNIT_PATH/$nunit_version"
|
||||||
|
|
||||||
NUNIT_ARCHIVE_PATH=$(download_with_retry "$NUNIT_ARCHIVE_URL")
|
nunit_archive_path=$(download_with_retry "$nunit_archive_url")
|
||||||
use_checksum_comparison "$NUNIT_ARCHIVE_PATH" "$NUNIT_ARCHIVE_SHA256"
|
use_checksum_comparison "$nunit_archive_path" "$nunit_archive_sha256"
|
||||||
echo "Installing NUnit ${NUNIT_VERSION}..."
|
echo "Installing NUnit ${nunit_version}..."
|
||||||
sudo mkdir -p "$NUNIT_VERSION_PATH"
|
sudo mkdir -p "$nunit_version_path"
|
||||||
sudo unzip -q "$NUNIT_ARCHIVE_PATH" -d "$NUNIT_VERSION_PATH"
|
sudo unzip -q "$nunit_archive_path" -d "$nunit_version_path"
|
||||||
|
|
||||||
# Create a wrapper script for nunit3-console
|
# Create a wrapper script for nunit3-console
|
||||||
echo "Creating nunit3-console wrapper..."
|
echo "Creating nunit3-console wrapper..."
|
||||||
NUNIT3_CONSOLE_WRAPPER=$(mktemp)
|
nunit3_console_wrapper=$(mktemp)
|
||||||
cat <<EOF > "$NUNIT3_CONSOLE_WRAPPER"
|
cat <<EOF > "$nunit3_console_wrapper"
|
||||||
#!/bin/bash -e -o pipefail
|
#!/bin/bash -e -o pipefail
|
||||||
exec ${MONO_VERSIONS_PATH}/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT_VERSION_PATH/nunit3-console.exe "\$@"
|
exec ${MONO_VERSIONS_PATH}/${mono_version}/bin/mono --debug \$MONO_OPTIONS $nunit_version_path/nunit3-console.exe "\$@"
|
||||||
EOF
|
EOF
|
||||||
cat "$NUNIT3_CONSOLE_WRAPPER"
|
cat "$nunit3_console_wrapper"
|
||||||
sudo chmod +x "$NUNIT3_CONSOLE_WRAPPER"
|
sudo chmod +x "$nunit3_console_wrapper"
|
||||||
sudo mv "$NUNIT3_CONSOLE_WRAPPER" "${MONO_VERSIONS_PATH}/${MONO_VERSION}/Commands/nunit3-console"
|
sudo mv "$nunit3_console_wrapper" "${MONO_VERSIONS_PATH}/${mono_version}/Commands/nunit3-console"
|
||||||
|
|
||||||
# Create a symlink for the short version of Mono (e.g., 6.12)
|
# Create a symlink for the short version of Mono (e.g., 6.12)
|
||||||
echo "Creating short symlink '${MONO_VERSION_SHORT}'..."
|
echo "Creating short symlink '${mono_version_short}'..."
|
||||||
sudo ln -s "${MONO_VERSIONS_PATH}/${MONO_VERSION}" "${MONO_VERSIONS_PATH}/${MONO_VERSION_SHORT}"
|
sudo ln -s "${MONO_VERSIONS_PATH}/${mono_version}" "${MONO_VERSIONS_PATH}/${mono_version_short}"
|
||||||
|
|
||||||
# Invoke tests for Xamarin and Mono
|
# Invoke tests for Xamarin and Mono
|
||||||
invoke_tests "Xamarin" "Mono"
|
invoke_tests "Xamarin" "Mono"
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ if bash "$nvm_installer_path"; then
|
|||||||
|
|
||||||
# set system node as default
|
# set system node as default
|
||||||
nvm alias default system
|
nvm alias default system
|
||||||
|
|
||||||
echo "Node version manager has been installed successfully"
|
echo "Node version manager has been installed successfully"
|
||||||
else
|
else
|
||||||
echo "Node version manager installation failed"
|
echo "Node version manager installation failed"
|
||||||
|
|||||||
@@ -8,19 +8,11 @@ source ~/utils/utils.sh
|
|||||||
|
|
||||||
export PATH="$PATH:/opt/pipx_bin"
|
export PATH="$PATH:/opt/pipx_bin"
|
||||||
|
|
||||||
toolset=$(get_toolset_path)
|
pipx_packages=$(get_toolset_value '.pipx[].package')
|
||||||
pipx_packages=$(jq -r ".pipx[] .package" $toolset)
|
|
||||||
|
|
||||||
for package in $pipx_packages; do
|
for package in $pipx_packages; do
|
||||||
python_version=$(jq -r ".pipx[] | select(.package == \"$package\") .python" $toolset)
|
echo "Install $package into default python"
|
||||||
if [ "$python_version" != "null" ]; then
|
pipx install $package
|
||||||
python_path="$HOME/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version"
|
|
||||||
echo "Install $package into python $python_path"
|
|
||||||
pipx install $package --python $python_path
|
|
||||||
else
|
|
||||||
echo "Install $package into default python"
|
|
||||||
pipx install $package
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
invoke_tests "PipxPackages"
|
invoke_tests "PipxPackages"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ arch=$(get_arch)
|
|||||||
|
|
||||||
metadata_json_path=$(download_with_retry "https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json")
|
metadata_json_path=$(download_with_retry "https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json")
|
||||||
version=$(jq -r '.LTSReleaseTag[0]' "$metadata_json_path")
|
version=$(jq -r '.LTSReleaseTag[0]' "$metadata_json_path")
|
||||||
download_url=$(get_github_package_download_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$version" "$API_PAT")
|
download_url=$(resolve_github_release_asset_url "PowerShell/PowerShell" "contains(\"osx-$arch.pkg\")" "$version" "$API_PAT")
|
||||||
pkg_path=$(download_with_retry "$download_url")
|
pkg_path=$(download_with_retry "$download_url")
|
||||||
|
|
||||||
# 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
|
# 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
|
||||||
|
|||||||
@@ -8,33 +8,33 @@ source ~/utils/utils.sh
|
|||||||
source ~/utils/xamarin-utils.sh
|
source ~/utils/xamarin-utils.sh
|
||||||
|
|
||||||
install_vsmac() {
|
install_vsmac() {
|
||||||
local VSMAC_VERSION=$1
|
local vsmac_version=$1
|
||||||
local VSMAC_DEFAULT=$2
|
local vsmac_default=$2
|
||||||
if [ $VSMAC_VERSION == "2019" ]; then
|
if [[ $vsmac_version == "2019" ]]; then
|
||||||
VSMAC_DOWNLOAD_URL=$(curl -fsSL "https://aka.ms/manifest/stable" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/stable" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||||
elif [ $VSMAC_VERSION == "2022" ]; then
|
elif [[ $vsmac_version == "2022" ]]; then
|
||||||
VSMAC_DOWNLOAD_URL=$(curl -fsSL "https://aka.ms/manifest/stable-2022" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/stable-2022" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||||
elif [ $VSMAC_VERSION == "preview" ]; then
|
elif [[ $vsmac_version == "preview" ]]; then
|
||||||
VSMAC_DOWNLOAD_URL=$(curl -fsSL "https://aka.ms/manifest/preview" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
vsmac_download_url=$(curl -fsSL "https://aka.ms/manifest/preview" | jq -r '.items[] | select(.genericName=="VisualStudioMac").url')
|
||||||
else
|
else
|
||||||
VSMAC_DOWNLOAD_URL=$(buildVSMacDownloadUrl $VSMAC_VERSION)
|
vsmac_download_url=$(buildVSMacDownloadUrl $vsmac_version)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing Visual Studio ${VSMAC_VERSION} for Mac"
|
echo "Installing Visual Studio ${vsmac_version} for Mac"
|
||||||
TMPMOUNT=$(/usr/bin/mktemp -d /tmp/visualstudio.XXXX)
|
TMPMOUNT=$(/usr/bin/mktemp -d /tmp/visualstudio.XXXX)
|
||||||
mkdir -p "$TMPMOUNT/downloads"
|
mkdir -p "$TMPMOUNT/downloads"
|
||||||
|
|
||||||
VSMAC_INSTALLER=$(download_with_retry "$VSMAC_DOWNLOAD_URL" "$TMPMOUNT/downloads/${VSMAC_DOWNLOAD_URL##*/}")
|
vsmac_installer=$(download_with_retry "$vsmac_download_url" "$TMPMOUNT/downloads/${vsmac_download_url##*/}")
|
||||||
|
|
||||||
echo "Mounting Visual Studio..."
|
echo "Mounting Visual Studio..."
|
||||||
hdiutil attach "$VSMAC_INSTALLER" -mountpoint "$TMPMOUNT"
|
hdiutil attach "$vsmac_installer" -mountpoint "$TMPMOUNT"
|
||||||
|
|
||||||
echo "Moving Visual Studio to /Applications/..."
|
echo "Moving Visual Studio to /Applications/..."
|
||||||
pushd "$TMPMOUNT"
|
pushd "$TMPMOUNT"
|
||||||
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
|
tar cf - "./Visual Studio.app" | tar xf - -C /Applications/
|
||||||
|
|
||||||
if [ $VSMAC_VERSION != $VSMAC_DEFAULT ]; then
|
if [[ $vsmac_version != $vsmac_default ]]; then
|
||||||
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio ${VSMAC_VERSION}.app"
|
mv "/Applications/Visual Studio.app" "/Applications/Visual Studio ${vsmac_version}.app"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd
|
popd
|
||||||
@@ -42,11 +42,11 @@ install_vsmac() {
|
|||||||
sudo rm -rf "$TMPMOUNT"
|
sudo rm -rf "$TMPMOUNT"
|
||||||
}
|
}
|
||||||
|
|
||||||
VSMAC_VERSIONS=($(get_toolset_value '.xamarin.vsmac.versions[]'))
|
vsmac_versions=($(get_toolset_value '.xamarin.vsmac.versions[]'))
|
||||||
DEFAULT_VSMAC_VERSION=$(get_toolset_value '.xamarin.vsmac.default')
|
default_vsmac_version=$(get_toolset_value '.xamarin.vsmac.default')
|
||||||
|
|
||||||
for VERSION in "${VSMAC_VERSIONS[@]}"; do
|
for version in "${vsmac_versions[@]}"; do
|
||||||
install_vsmac $VERSION $DEFAULT_VSMAC_VERSION
|
install_vsmac $version $default_vsmac_version
|
||||||
done
|
done
|
||||||
|
|
||||||
invoke_tests "Common" "VSMac"
|
invoke_tests "Common" "VSMac"
|
||||||
|
|||||||
@@ -7,16 +7,16 @@
|
|||||||
source ~/utils/utils.sh
|
source ~/utils/utils.sh
|
||||||
source ~/utils/xamarin-utils.sh
|
source ~/utils/xamarin-utils.sh
|
||||||
|
|
||||||
MONO_VERSIONS=($(get_toolset_value '.xamarin."mono_versions" | reverse | .[]'))
|
mono_versions=($(get_toolset_value '.xamarin."mono_versions" | reverse | .[]'))
|
||||||
XAMARIN_IOS_VERSIONS=($(get_toolset_value '.xamarin."ios_versions" | reverse | .[]'))
|
xamarin_ios_versions=($(get_toolset_value '.xamarin."ios_versions" | reverse | .[]'))
|
||||||
XAMARIN_MAC_VERSIONS=($(get_toolset_value '.xamarin."mac_versions" | reverse | .[]'))
|
xamarin_mac_versions=($(get_toolset_value '.xamarin."mac_versions" | reverse | .[]'))
|
||||||
XAMARIN_ANDROID_VERSIONS=($(get_toolset_value '.xamarin."android_versions" | reverse | .[]'))
|
xamarin_android_versions=($(get_toolset_value '.xamarin."android_versions" | reverse | .[]'))
|
||||||
LATEST_SDK_SYMLINK=$(get_toolset_value '.xamarin.bundles[0].symlink')
|
latest_sdk_symlink=$(get_toolset_value '.xamarin.bundles[0].symlink')
|
||||||
CURRENT_SDK_SYMLINK=$(get_toolset_value '.xamarin."bundle_default"')
|
current_sdk_symlink=$(get_toolset_value '.xamarin."bundle_default"')
|
||||||
DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default')
|
default_xcode_version=$(get_toolset_value '.xcode.default')
|
||||||
|
|
||||||
if [ "$CURRENT_SDK_SYMLINK" == "latest" ]; then
|
if [ "$current_sdk_symlink" == "latest" ]; then
|
||||||
CURRENT_SDK_SYMLINK=$LATEST_SDK_SYMLINK
|
current_sdk_symlink=$latest_sdk_symlink
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions'
|
MONO_VERSIONS_PATH='/Library/Frameworks/Mono.framework/Versions'
|
||||||
@@ -34,36 +34,36 @@ pushd $TMPMOUNT
|
|||||||
downloadNUnitConsole
|
downloadNUnitConsole
|
||||||
|
|
||||||
# Install Mono sdks
|
# Install Mono sdks
|
||||||
for VERSION in "${MONO_VERSIONS[@]}"; do installMono $VERSION; done
|
for version in "${mono_versions[@]}"; do installMono $version; done
|
||||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/mono/* $MONO_VERSIONS_PATH/
|
sudo mv -v $TMPMOUNT_FRAMEWORKS/mono/* $MONO_VERSIONS_PATH/
|
||||||
|
|
||||||
# Install Xamarin.iOS sdks
|
# Install Xamarin.iOS sdks
|
||||||
for VERSION in "${XAMARIN_IOS_VERSIONS[@]}"; do installXamarinIOS $VERSION; done
|
for version in "${xamarin_ios_versions[@]}"; do installXamarinIOS $version; done
|
||||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/ios/* $IOS_VERSIONS_PATH/
|
sudo mv -v $TMPMOUNT_FRAMEWORKS/ios/* $IOS_VERSIONS_PATH/
|
||||||
|
|
||||||
# Install Xamarin.Mac sdks
|
# Install Xamarin.Mac sdks
|
||||||
for VERSION in "${XAMARIN_MAC_VERSIONS[@]}"; do installXamarinMac $VERSION; done
|
for version in "${xamarin_mac_versions[@]}"; do installXamarinMac $version; done
|
||||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/mac/* $MAC_VERSIONS_PATH/
|
sudo mv -v $TMPMOUNT_FRAMEWORKS/mac/* $MAC_VERSIONS_PATH/
|
||||||
|
|
||||||
# Install Xamarin.Android sdks
|
# Install Xamarin.Android sdks
|
||||||
for VERSION in "${XAMARIN_ANDROID_VERSIONS[@]}"; do installXamarinAndroid $VERSION; done
|
for version in "${xamarin_android_versions[@]}"; do installXamarinAndroid $version; done
|
||||||
sudo mv -v $TMPMOUNT_FRAMEWORKS/android/* $ANDROID_VERSIONS_PATH/
|
sudo mv -v $TMPMOUNT_FRAMEWORKS/android/* $ANDROID_VERSIONS_PATH/
|
||||||
|
|
||||||
|
|
||||||
# Create bundles
|
# Create bundles
|
||||||
BUNDLES_COUNT=$(get_toolset_value '.xamarin.bundles | length')
|
bundles_count=$(get_toolset_value '.xamarin.bundles | length')
|
||||||
for ((BUNDLE_INDEX=0; BUNDLE_INDEX<BUNDLES_COUNT; BUNDLE_INDEX++)); do
|
for ((bundle_index=0; bundle_index<bundles_count; bundle_index++)); do
|
||||||
SYMLINK=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].symlink")
|
symlink=$(get_toolset_value ".xamarin.bundles[$bundle_index].symlink")
|
||||||
MONO=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].mono")
|
mono=$(get_toolset_value ".xamarin.bundles[$bundle_index].mono")
|
||||||
IOS=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].ios")
|
ios=$(get_toolset_value ".xamarin.bundles[$bundle_index].ios")
|
||||||
MAC=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].mac")
|
mac=$(get_toolset_value ".xamarin.bundles[$bundle_index].mac")
|
||||||
ANDROID=$(get_toolset_value ".xamarin.bundles[$BUNDLE_INDEX].android")
|
android=$(get_toolset_value ".xamarin.bundles[$bundle_index].android")
|
||||||
createBundle $SYMLINK $MONO $IOS $MAC $ANDROID
|
createBundle $symlink $mono $ios $mac $android
|
||||||
done
|
done
|
||||||
|
|
||||||
# Symlinks for the latest Xamarin bundle
|
# Symlinks for the latest Xamarin bundle
|
||||||
createBundleLink $LATEST_SDK_SYMLINK "Latest"
|
createBundleLink $latest_sdk_symlink "Latest"
|
||||||
createBundleLink $CURRENT_SDK_SYMLINK "Current"
|
createBundleLink $current_sdk_symlink "Current"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Fix nuget in some mono versions because of known bugs
|
# Fix nuget in some mono versions because of known bugs
|
||||||
@@ -80,7 +80,7 @@ sudo rm -rf "$TMPMOUNT"
|
|||||||
# Fix Xamarin issue with Xcode symlink: https://github.com/xamarin/xamarin-macios/issues/9960
|
# Fix Xamarin issue with Xcode symlink: https://github.com/xamarin/xamarin-macios/issues/9960
|
||||||
PREFERENCES_XAMARIN_DIR="${HOME}/Library/Preferences/Xamarin"
|
PREFERENCES_XAMARIN_DIR="${HOME}/Library/Preferences/Xamarin"
|
||||||
mkdir -p $PREFERENCES_XAMARIN_DIR
|
mkdir -p $PREFERENCES_XAMARIN_DIR
|
||||||
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string /Applications/Xcode_${DEFAULT_XCODE_VERSION}.app" $PREFERENCES_XAMARIN_DIR/Settings.plist
|
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string /Applications/Xcode_${default_xcode_version}.app" $PREFERENCES_XAMARIN_DIR/Settings.plist
|
||||||
|
|
||||||
# Temporary workaround to recreate nuget.config file with a correct feed https://github.com/actions/runner-images/issues/5768
|
# Temporary workaround to recreate nuget.config file with a correct feed https://github.com/actions/runner-images/issues/5768
|
||||||
rm -rf $HOME/.config/NuGet/NuGet.Config
|
rm -rf $HOME/.config/NuGet/NuGet.Config
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ SIMS_TO_INSTALL=(
|
|||||||
"10.3"
|
"10.3"
|
||||||
)
|
)
|
||||||
|
|
||||||
for SIM_VERSION in ${SIMS_TO_INSTALL[@]}
|
for sim_version in ${SIMS_TO_INSTALL[@]}
|
||||||
do
|
do
|
||||||
echo "Installing iOS $SIM_VERSION ..."
|
echo "Installing iOS $sim_version ..."
|
||||||
sudo xcversion simulators --install="iOS ${SIM_VERSION}"
|
sudo xcversion simulators --install="iOS ${sim_version}"
|
||||||
echo "Successfuly installed iOS $SIM_VERSION ..."
|
echo "Successfuly installed iOS $sim_version ..."
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Done installing simulator runtimes."
|
echo "Done installing simulator runtimes."
|
||||||
|
|||||||
@@ -78,15 +78,11 @@ is_BigSur() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
is_Veertu() {
|
is_Veertu() {
|
||||||
[ -d "/Library/Application Support/Veertu" ]
|
[[ -d "/Library/Application Support/Veertu" ]]
|
||||||
}
|
|
||||||
|
|
||||||
get_toolset_path() {
|
|
||||||
echo "$HOME/image-generation/toolset.json"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get_toolset_value() {
|
get_toolset_value() {
|
||||||
local toolset_path=$(get_toolset_path)
|
local toolset_path=$(echo "$HOME/image-generation/toolset.json")
|
||||||
local query=$1
|
local query=$1
|
||||||
echo "$(jq -r "$query" $toolset_path)"
|
echo "$(jq -r "$query" $toolset_path)"
|
||||||
}
|
}
|
||||||
@@ -96,32 +92,6 @@ verlte() {
|
|||||||
[ "$1" = "$sortedVersion" ]
|
[ "$1" = "$sortedVersion" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
brew_cask_install_ignoring_sha256() {
|
|
||||||
local TOOL_NAME=$1
|
|
||||||
|
|
||||||
CASK_DIR="$(brew --repo homebrew/cask)/Casks"
|
|
||||||
chmod a+w "$CASK_DIR/$TOOL_NAME.rb"
|
|
||||||
SHA=$(grep "sha256" "$CASK_DIR/$TOOL_NAME.rb" | awk '{print $2}')
|
|
||||||
sed -i '' "s/$SHA/:no_check/" "$CASK_DIR/$TOOL_NAME.rb"
|
|
||||||
brew install --cask $TOOL_NAME
|
|
||||||
pushd $CASK_DIR
|
|
||||||
git checkout HEAD -- "$TOOL_NAME.rb"
|
|
||||||
popd
|
|
||||||
}
|
|
||||||
|
|
||||||
get_brew_os_keyword() {
|
|
||||||
if is_BigSur; then
|
|
||||||
echo "big_sur"
|
|
||||||
elif is_Monterey; then
|
|
||||||
echo "monterey"
|
|
||||||
elif is_Ventura; then
|
|
||||||
echo "ventura"
|
|
||||||
elif is_Sonoma; then
|
|
||||||
echo "sonoma"
|
|
||||||
else
|
|
||||||
echo "null"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# brew provides package bottles for different macOS versions
|
# brew provides package bottles for different macOS versions
|
||||||
# The 'brew install' command will fail if a package bottle does not exist
|
# The 'brew install' command will fail if a package bottle does not exist
|
||||||
@@ -172,7 +142,6 @@ brew_smart_install() {
|
|||||||
|
|
||||||
configure_system_tccdb () {
|
configure_system_tccdb () {
|
||||||
local values=$1
|
local values=$1
|
||||||
|
|
||||||
local dbPath="/Library/Application Support/com.apple.TCC/TCC.db"
|
local dbPath="/Library/Application Support/com.apple.TCC/TCC.db"
|
||||||
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
||||||
sudo sqlite3 "$dbPath" "$sqlQuery"
|
sudo sqlite3 "$dbPath" "$sqlQuery"
|
||||||
@@ -180,46 +149,38 @@ configure_system_tccdb () {
|
|||||||
|
|
||||||
configure_user_tccdb () {
|
configure_user_tccdb () {
|
||||||
local values=$1
|
local values=$1
|
||||||
|
|
||||||
local dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
|
local dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
|
||||||
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
||||||
sqlite3 "$dbPath" "$sqlQuery"
|
sqlite3 "$dbPath" "$sqlQuery"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_github_package_download_url() {
|
resolve_github_release_asset_url() {
|
||||||
local REPO_ORG=$1
|
local repo=$1
|
||||||
local FILTER=$2
|
local filter=$2
|
||||||
local VERSION=$3
|
local version=${3:-"*"}
|
||||||
local API_PAT=$4
|
local api_pat=$4
|
||||||
local SEARCH_IN_COUNT="100"
|
|
||||||
|
|
||||||
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
|
page_size="100"
|
||||||
|
|
||||||
failed=true
|
[ -n "$api_pat" ] && authString=(-H "Authorization: token ${api_pat}")
|
||||||
for i in {1..10}; do
|
|
||||||
curl "${authString[@]}" -fsSL "https://api.github.com/repos/${REPO_ORG}/releases?per_page=${SEARCH_IN_COUNT}" >/tmp/get_github_package_download_url.json && failed=false || sleep 60
|
|
||||||
[ "$failed" = false ] && break
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$failed" = true ]; then
|
json=$(curl "${authString[@]}" -fsSL "https://api.github.com/repos/${repo}/releases?per_page=${page_size}")
|
||||||
echo "Failed: get_github_package_download_url"
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
json=$(cat /tmp/get_github_package_download_url.json)
|
if [[ $version == "latest" ]]; then
|
||||||
|
tag_name=$(echo $json | jq -r '.[].tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]|beta" | tail -n 1)
|
||||||
if [[ "$VERSION" == "latest" ]]; then
|
elif [[ $version == *"*"* ]]; then
|
||||||
tagName=$(echo $json | jq -r '.[] | select((.prerelease==false) and (.assets | length > 0)).tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]" | tail -1)
|
tag_name=$(echo $json | jq -r '.[].tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]|beta" | egrep "${version}" | tail -n 1)
|
||||||
else
|
else
|
||||||
tagName=$(echo $json | jq -r '.[] | select(.prerelease==false).tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]" | egrep "\w*${VERSION}" | tail -1)
|
tag_name=$(echo $json | jq -r '.[].tag_name' | sort --unique --version-sort | egrep -v ".*-[a-z]|beta" | egrep "${version}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
downloadUrl=$(echo $json | jq -r ".[] | select(.tag_name==\"${tagName}\").assets[].browser_download_url | select(${FILTER})" | head -n 1)
|
download_url=$(echo $json | jq -r ".[] | select(.tag_name==\"${tag_name}\").assets[].browser_download_url | select(${filter})" | head -n 1)
|
||||||
if [ -z "$downloadUrl" ]; then
|
if [ -z "$download_url" ]; then
|
||||||
echo "Failed to parse a download url for the '${tagName}' tag using '${FILTER}' filter"
|
echo "Failed to parse a download url for the '${tag_name}' tag using '${filter}' filter"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo $downloadUrl
|
|
||||||
|
echo $download_url
|
||||||
}
|
}
|
||||||
|
|
||||||
# Close all finder windows because they can interfere with UI tests
|
# Close all finder windows because they can interfere with UI tests
|
||||||
|
|||||||
11
images/macos/scripts/tests/Rosetta.Tests.ps1
Normal file
11
images/macos/scripts/tests/Rosetta.Tests.ps1
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||||
|
|
||||||
|
$os = Get-OSVersion
|
||||||
|
|
||||||
|
Describe "Rosetta" -Skip:(-not $os.IsArm64) {
|
||||||
|
It "Rosetta is available" {
|
||||||
|
$commandResult = Get-CommandResult "/usr/bin/pgrep oahd"
|
||||||
|
$commandResult.Output | Should -Match "\d+"
|
||||||
|
$commandResult.ExitCode | Should -Be 0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -131,8 +131,7 @@ build {
|
|||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
scripts = [
|
scripts = [
|
||||||
"./scripts/build/install-xcode-clt.sh",
|
"./scripts/build/install-xcode-clt.sh",
|
||||||
"./scripts/build/install-homebrew.sh",
|
"./scripts/build/install-homebrew.sh"
|
||||||
"./scripts/build/install-rosetta.sh"
|
|
||||||
]
|
]
|
||||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
|
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
|
||||||
}
|
}
|
||||||
@@ -170,6 +169,7 @@ build {
|
|||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
pause_before = "30s"
|
pause_before = "30s"
|
||||||
scripts = [
|
scripts = [
|
||||||
|
"./scripts/build/install-rosetta.sh",
|
||||||
"./scripts/build/configure-windows.sh",
|
"./scripts/build/configure-windows.sh",
|
||||||
"./scripts/build/install-powershell.sh",
|
"./scripts/build/install-powershell.sh",
|
||||||
"./scripts/build/install-mono.sh",
|
"./scripts/build/install-mono.sh",
|
||||||
|
|||||||
Reference in New Issue
Block a user