[macOS] Refactor the rest of the scripts (#9113)

* [macOS] Refactor the rest of the scripts

* Return quotes to config tccdb script

* Return quotes to config tccdb script

* Revert some changes in ruby scripts

* Revert some changes in ruby scripts

* Revert some changes chrome script

* check errors

* check errors 01

* find errors in common-utils

* find errors in edge install

* find errors in edge install

---------

Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
This commit is contained in:
Alexey-Ayupov
2024-01-09 14:47:31 +01:00
committed by GitHub
parent 5bdda2e8c2
commit 5a6e215859
48 changed files with 203 additions and 264 deletions

View File

@@ -8,7 +8,7 @@ source ~/utils/utils.sh
arch=$(get_arch)
DEFAULT_RUBY_VERSION=$(get_toolset_value '.ruby.default')
echo Installing Ruby...
echo "Installing Ruby..."
brew_smart_install "ruby@${DEFAULT_RUBY_VERSION}"
if [[ $arch == "arm64" ]]; then
export PATH=/opt/homebrew/opt/ruby@${DEFAULT_RUBY_VERSION}/bin:$PATH
@@ -16,12 +16,12 @@ else
export PATH=/usr/local/opt/ruby@${DEFAULT_RUBY_VERSION}/bin:$PATH
fi
GEM_PATH=`gem env|awk '/EXECUTABLE DIRECTORY/ {print $4}'`
echo "GEM_PATH=$GEM_PATH" >> "$HOME/.bashrc"
GEM_PATH=$(gem env|awk '/EXECUTABLE DIRECTORY/ {print $4}')
echo "GEM_PATH=$GEM_PATH" >> $HOME/.bashrc
if [[ $arch == "arm64" ]]; then
echo 'export PATH="$GEM_PATH:/opt/homebrew/opt/ruby@'${DEFAULT_RUBY_VERSION}'/bin:$PATH"' >> "$HOME/.bashrc"
echo 'export PATH="$GEM_PATH:/opt/homebrew/opt/ruby@'${DEFAULT_RUBY_VERSION}'/bin:$PATH"' >> $HOME/.bashrc
else
echo 'export PATH="$GEM_PATH:/usr/local/opt/ruby@'${DEFAULT_RUBY_VERSION}'/bin:$PATH"' >> "$HOME/.bashrc"
echo 'export PATH="$GEM_PATH:/usr/local/opt/ruby@'${DEFAULT_RUBY_VERSION}'/bin:$PATH"' >> $HOME/.bashrc
fi
if ! is_Arm64; then
@@ -29,13 +29,13 @@ if ! is_Arm64; then
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
PACKAGE_TAR_NAMES=$(curl "${authString[@]}" -fsSL "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .arch.'$arch'.versions[]')
RUBY_PATH="$AGENT_TOOLSDIRECTORY/Ruby"
RUBY_PATH=$AGENT_TOOLSDIRECTORY/Ruby
echo "Check if Ruby hostedtoolcache folder exists..."
if [ ! -d $RUBY_PATH ]; then
if [[ ! -d $RUBY_PATH ]]; then
mkdir -p $RUBY_PATH
fi
echo "ruby path - $RUBY_PATH "
for TOOLSET_VERSION in ${TOOLSET_VERSIONS[@]}; do
PACKAGE_TAR_NAME=$(echo "$PACKAGE_TAR_NAMES" | grep "^ruby-${TOOLSET_VERSION}-macos-latest.tar.gz$" | egrep -v "rc|preview" | sort -V | tail -1)
RUBY_VERSION=$(echo "$PACKAGE_TAR_NAME" | cut -d'-' -f 2)
@@ -47,10 +47,10 @@ if ! is_Arm64; then
echo "Downloading tar archive $PACKAGE_TAR_NAME"
ARCHIVE_PATH=$(download_with_retry "https://github.com/ruby/ruby-builder/releases/download/toolcache/${PACKAGE_TAR_NAME}")
echo "Expand '$PACKAGE_TAR_NAME' to the '$RUBY_VERSION_PATH' folder"
tar xf "$ARCHIVE_PATH" -C $RUBY_VERSION_PATH
COMPLETE_FILE_PATH="$RUBY_VERSION_PATH/x64.complete"
if [ ! -f $COMPLETE_FILE_PATH ]; then
echo "Expand $PACKAGE_TAR_NAME to the $RUBY_VERSION_PATH folder"
tar xf $ARCHIVE_PATH -C $RUBY_VERSION_PATH
COMPLETE_FILE_PATH=$RUBY_VERSION_PATH/x64.complete
if [[ ! -f $COMPLETE_FILE_PATH ]]; then
echo "Create complete file"
touch $COMPLETE_FILE_PATH
fi