diff --git a/images/macos/provision/configuration/add-network-interface-detection.sh b/images/macos/provision/configuration/add-network-interface-detection.sh index e939f04b6..ca9192bf4 100755 --- a/images/macos/provision/configuration/add-network-interface-detection.sh +++ b/images/macos/provision/configuration/add-network-interface-detection.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail # This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/add-network-interface-detection.sh # Distributed by MIT license, license can be found at the bottom of this script diff --git a/images/macos/provision/configuration/autologin.sh b/images/macos/provision/configuration/autologin.sh index caa29a6b9..02f2f06d9 100755 --- a/images/macos/provision/configuration/autologin.sh +++ b/images/macos/provision/configuration/autologin.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + # This script was taken from https://github.com/timsutton/osx-vm-templates/blob/master/scripts/autologin.sh # Distributed by MIT license, license can be found at the bottom of this script diff --git a/images/macos/provision/configuration/configure-hostname.sh b/images/macos/provision/configuration/configure-hostname.sh index 477e09807..e0de0bf8e 100644 --- a/images/macos/provision/configuration/configure-hostname.sh +++ b/images/macos/provision/configuration/configure-hostname.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail # Add script for changing hostname to run on startup to prevent duplicate hostnames across the environment. Hostname and Computername should contain .local in name to avoid name resolution issues tee -a /usr/local/bin/change_hostname.sh > /dev/null <<\EOF -#!/bin/bash +#!/bin/bash -e -o pipefail name="Mac-$(python -c 'from time import time; print int(round(time() * 1000))')" scutil --set HostName "${name}.local" diff --git a/images/macos/provision/configuration/configure-machine.sh b/images/macos/provision/configuration/configure-machine.sh index dbfae6731..df991c211 100644 --- a/images/macos/provision/configuration/configure-machine.sh +++ b/images/macos/provision/configuration/configure-machine.sh @@ -1,12 +1,4 @@ -#!/bin/bash - -# Enable firewall. SSH and VNC opened. Can't did it at bootstrap step, so placed it here -defaults write /Library/Preferences/com.apple.alf globalstate -int 1 - -# Setting correct time zone -echo "Configuring system time to GMT..." -rm -f /etc/localtime -ln -sf /usr/share/zoneinfo/UTC /etc/localtime +#!/bin/bash -e -o pipefail # https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari # Safari’s executable is located at /usr/bin/safaridriver diff --git a/images/macos/provision/configuration/configure-ssh.sh b/images/macos/provision/configuration/configure-ssh.sh index f85e9efa2..73095f551 100755 --- a/images/macos/provision/configuration/configure-ssh.sh +++ b/images/macos/provision/configuration/configure-ssh.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail [[ ! -d ~/.ssh ]] && mkdir ~/.ssh 2>/dev/null chmod 777 ~/.ssh diff --git a/images/macos/provision/configuration/disable-auto-updates.sh b/images/macos/provision/configuration/disable-auto-updates.sh index 3a35f5be7..050f7d9a9 100755 --- a/images/macos/provision/configuration/disable-auto-updates.sh +++ b/images/macos/provision/configuration/disable-auto-updates.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail # Disabling automatic updates sudo softwareupdate --schedule off diff --git a/images/macos/provision/configuration/finalize-vm.sh b/images/macos/provision/configuration/finalize-vm.sh index b01b3c232..b69751398 100644 --- a/images/macos/provision/configuration/finalize-vm.sh +++ b/images/macos/provision/configuration/finalize-vm.sh @@ -1,12 +1,16 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail + +source ~/utils/utils.sh # Close all finder windows because they can interfere with UI tests osascript -e 'tell application "Finder" to close windows' -# Ignore available updates to prevent system pop-ups -updateName=$(softwareupdate -l | grep "Title: " | awk -F[:,] '{print $2}' | awk '{$1=$1};1') -if [ ! -z "$updateName" ]; then - sudo softwareupdate --ignore "$updateName" +if is_Less_BigSur; then + # Ignore available updates to prevent system pop-ups + updateName=$(softwareupdate -l | grep "Title: " | awk -F[:,] '{print $2}' | awk '{$1=$1};1') || true + if [ ! -z "$updateName" ]; then + sudo softwareupdate --ignore "$updateName" + fi fi # Put documentation to $HOME root diff --git a/images/macos/provision/configuration/max-files.sh b/images/macos/provision/configuration/max-files.sh index a6e41f120..cd1df451a 100755 --- a/images/macos/provision/configuration/max-files.sh +++ b/images/macos/provision/configuration/max-files.sh @@ -1,6 +1,4 @@ -#!/bin/bash - -set -e +#!/bin/bash -e -o pipefail Launch_Daemons="/Library/LaunchDaemons" diff --git a/images/macos/provision/configuration/ntpconf.sh b/images/macos/provision/configuration/ntpconf.sh index 09916cc37..b4f681280 100755 --- a/images/macos/provision/configuration/ntpconf.sh +++ b/images/macos/provision/configuration/ntpconf.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail echo Additional NTP servers adding into /etc/ntp.conf file... cat > /etc/ntp.conf << EOF diff --git a/images/macos/provision/configuration/preimagedata.sh b/images/macos/provision/configuration/preimagedata.sh index c269a1492..8060acb74 100644 --- a/images/macos/provision/configuration/preimagedata.sh +++ b/images/macos/provision/configuration/preimagedata.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh imagedata_file="$HOME/imagedata.json" diff --git a/images/macos/provision/configuration/screensaver-off.sh b/images/macos/provision/configuration/screensaver-off.sh index c154f8d8f..6844792e5 100755 --- a/images/macos/provision/configuration/screensaver-off.sh +++ b/images/macos/provision/configuration/screensaver-off.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail + # set screensaver idleTime to 0, to prevent turning screensaver on macUUID=`ioreg -rd1 -c IOPlatformExpertDevice | grep -i "UUID" | cut -c27-62` diff --git a/images/macos/provision/configuration/shell-change.sh b/images/macos/provision/configuration/shell-change.sh index a84216cbb..5fb12a03e 100644 --- a/images/macos/provision/configuration/shell-change.sh +++ b/images/macos/provision/configuration/shell-change.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + echo "Changing shell to bash" sudo chsh -s /bin/bash $USERNAME sudo chsh -s /bin/bash root \ No newline at end of file diff --git a/images/macos/provision/core/android-toolsets.sh b/images/macos/provision/core/android-toolsets.sh index 093a133ce..2f6139c8a 100755 --- a/images/macos/provision/core/android-toolsets.sh +++ b/images/macos/provision/core/android-toolsets.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash -e -o pipefail source ~/utils/utils.sh function filter_components_by_version { diff --git a/images/macos/provision/core/audiodevice.sh b/images/macos/provision/core/audiodevice.sh index 4a151e3f9..ec7d71d93 100644 --- a/images/macos/provision/core/audiodevice.sh +++ b/images/macos/provision/core/audiodevice.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail echo "install soundflower" brew cask install soundflower diff --git a/images/macos/provision/core/aws.sh b/images/macos/provision/core/aws.sh index 4d98d5122..02009449a 100644 --- a/images/macos/provision/core/aws.sh +++ b/images/macos/provision/core/aws.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail echo Installing aws... curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" diff --git a/images/macos/provision/core/azcopy.sh b/images/macos/provision/core/azcopy.sh index 56b848e92..5098c8789 100755 --- a/images/macos/provision/core/azcopy.sh +++ b/images/macos/provision/core/azcopy.sh @@ -1,5 +1,4 @@ -#!/bin/bash -set -e +#!/bin/bash -e -o pipefail AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac" diff --git a/images/macos/provision/core/build-xcode-symlinks.sh b/images/macos/provision/core/build-xcode-symlinks.sh index 0cee8df88..600709387 100644 --- a/images/macos/provision/core/build-xcode-symlinks.sh +++ b/images/macos/provision/core/build-xcode-symlinks.sh @@ -1,4 +1,4 @@ -set -e +#!/bin/bash -e -o pipefail source ~/utils/utils.sh diff --git a/images/macos/provision/core/chrome.sh b/images/macos/provision/core/chrome.sh index 203faee74..4a9deba1a 100644 --- a/images/macos/provision/core/chrome.sh +++ b/images/macos/provision/core/chrome.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + echo "Installing Chrome..." brew cask install google-chrome diff --git a/images/macos/provision/core/cocoapods.sh b/images/macos/provision/core/cocoapods.sh index edf2a85f2..d692bf3d6 100755 --- a/images/macos/provision/core/cocoapods.sh +++ b/images/macos/provision/core/cocoapods.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail + echo "Installing Cocoapods..." # Setup the Cocoapods master repo diff --git a/images/macos/provision/core/commonutils.sh b/images/macos/provision/core/commonutils.sh index 5a98f004f..c7e93496c 100644 --- a/images/macos/provision/core/commonutils.sh +++ b/images/macos/provision/core/commonutils.sh @@ -1,5 +1,4 @@ -#!/bin/sh -set -e +#!/bin/bash -e -o pipefail source ~/utils/utils.sh diff --git a/images/macos/provision/core/dotnet.sh b/images/macos/provision/core/dotnet.sh index 780564881..36df3be9d 100755 --- a/images/macos/provision/core/dotnet.sh +++ b/images/macos/provision/core/dotnet.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail ########################################################################### # The main idea of this script is to automate dotnet installs @@ -23,7 +23,7 @@ echo "Parsing dotnet SDK (except rc and preview versions) from .json..." if is_BigSur; then DOTNET_CHANNELS=( 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' - 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' ) elif is_Less_Catalina; then DOTNET_CHANNELS=( @@ -33,7 +33,7 @@ else DOTNET_CHANNELS=( 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/2.1/releases.json' 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.0/releases.json' - 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' + 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/3.1/releases.json' ) fi diff --git a/images/macos/provision/core/edge.sh b/images/macos/provision/core/edge.sh index bc19a5666..da1673e0a 100644 --- a/images/macos/provision/core/edge.sh +++ b/images/macos/provision/core/edge.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh echo "Installing Microsoft Edge..." diff --git a/images/macos/provision/core/firefox.sh b/images/macos/provision/core/firefox.sh index f6a90d619..b9ee1c5ea 100644 --- a/images/macos/provision/core/firefox.sh +++ b/images/macos/provision/core/firefox.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + echo "Installing Firefox..." brew cask install firefox diff --git a/images/macos/provision/core/gcc.sh b/images/macos/provision/core/gcc.sh index febc0760c..fefe20fd6 100644 --- a/images/macos/provision/core/gcc.sh +++ b/images/macos/provision/core/gcc.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail echo "Installing GCC@8 using homebrew..." brew install gcc@8 diff --git a/images/macos/provision/core/git.sh b/images/macos/provision/core/git.sh index 55feb92b0..d59ebf915 100644 --- a/images/macos/provision/core/git.sh +++ b/images/macos/provision/core/git.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + echo Installing Git... brew install git diff --git a/images/macos/provision/core/haskell.sh b/images/macos/provision/core/haskell.sh index 1bc11d915..b7f35e4d7 100644 --- a/images/macos/provision/core/haskell.sh +++ b/images/macos/provision/core/haskell.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh export PATH="$HOME/.ghcup/bin:$PATH" diff --git a/images/macos/provision/core/miniconda.sh b/images/macos/provision/core/miniconda.sh index b214b352e..876883a6b 100644 --- a/images/macos/provision/core/miniconda.sh +++ b/images/macos/provision/core/miniconda.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail MINICONDA_INSTALLER="/tmp/miniconda.sh" curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER diff --git a/images/macos/provision/core/mongodb.sh b/images/macos/provision/core/mongodb.sh index 1b6a5a8d9..3a4440d90 100644 --- a/images/macos/provision/core/mongodb.sh +++ b/images/macos/provision/core/mongodb.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail # MongoDB object-value database # installs last version of MongoDB Community Edition diff --git a/images/macos/provision/core/node.sh b/images/macos/provision/core/node.sh index 840b433f9..59e727ce9 100644 --- a/images/macos/provision/core/node.sh +++ b/images/macos/provision/core/node.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh node_modules=( @@ -16,7 +18,6 @@ if is_Less_Catalina; then echo Installing NPM 3.x.x... npm install -g npm@3 - npm config set prefix /usr/local # This step is required to install App Center CLI echo Installing Omelette... diff --git a/images/macos/provision/core/nvm.sh b/images/macos/provision/core/nvm.sh index 527bd4c62..c02ecf431 100755 --- a/images/macos/provision/core/nvm.sh +++ b/images/macos/provision/core/nvm.sh @@ -1,5 +1,4 @@ -#!/bin/sh - +#!/bin/bash -e -o pipefail ########################################################################### # The script installs node version manager with node versions 6,8,10 and 12 # @@ -24,11 +23,8 @@ if [ $? -eq 0 ]; then nvm alias node12 lts/erbium nvm alias node13 v13 nvm alias node14 v14 - - if is_Catalina || is_BigSur; then - # set system node as default - nvm alias default system - fi + # set system node as default + nvm alias default system else echo error fi diff --git a/images/macos/provision/core/openjdk.sh b/images/macos/provision/core/openjdk.sh index ca2c5f017..c2b22bafa 100644 --- a/images/macos/provision/core/openjdk.sh +++ b/images/macos/provision/core/openjdk.sh @@ -1,6 +1,4 @@ -#!/bin/sh - -set -e +#!/bin/bash -e -o pipefail source ~/utils/utils.sh diff --git a/images/macos/provision/core/openssl.sh b/images/macos/provision/core/openssl.sh index a058673a6..855c1c600 100755 --- a/images/macos/provision/core/openssl.sh +++ b/images/macos/provision/core/openssl.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail source ~/utils/utils.sh diff --git a/images/macos/provision/core/php.sh b/images/macos/provision/core/php.sh index 08c19f942..901114481 100644 --- a/images/macos/provision/core/php.sh +++ b/images/macos/provision/core/php.sh @@ -1,5 +1,4 @@ -#!/bin/sh -set -e +#!/bin/bash -e -o pipefail echo Installing PHP brew install php diff --git a/images/macos/provision/core/postgresql.sh b/images/macos/provision/core/postgresql.sh index f69e078aa..b5d7ab61c 100644 --- a/images/macos/provision/core/postgresql.sh +++ b/images/macos/provision/core/postgresql.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail #Install latest version of postgresql brew install postgres @@ -6,13 +6,21 @@ brew install postgres #Service postgresql should be started before use. brew services start postgresql -#Verify that PostgreSQL is ready for accept incoming connections. -# exit codes: -# ready - 0 -# reject - 1 -# connection timeout - 2 -# incorrect credentials or parameters - 3 -pg_isready +#Verify PostgreSQL is ready for accept incoming connections +echo "Check PostgreSQL service is running" +i=10 +COMMAND='pg_isready' +while [ $i -gt 0 ]; do + echo "Check PostgreSQL service status" + eval $COMMAND && break + ((i--)) + if [ $i == 0 ]; then + echo "PostgreSQL service not ready, all attempts exhausted" + exit 1 + fi + echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i" + sleep 10 +done #Stop postgresql brew services stop postgresql \ No newline at end of file diff --git a/images/macos/provision/core/powershell.sh b/images/macos/provision/core/powershell.sh index 5717adc74..12beeca64 100644 --- a/images/macos/provision/core/powershell.sh +++ b/images/macos/provision/core/powershell.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh echo Installing Azure CLI... diff --git a/images/macos/provision/core/pypy.sh b/images/macos/provision/core/pypy.sh index 5f24cd5f5..d55d785af 100644 --- a/images/macos/provision/core/pypy.sh +++ b/images/macos/provision/core/pypy.sh @@ -1,10 +1,9 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail ################################################################################ ## File: pypy.sh ## Desc: Installs PyPy ################################################################################ source ~/utils/utils.sh -set -e function InstallPyPy { diff --git a/images/macos/provision/core/python.sh b/images/macos/provision/core/python.sh index 1565ced20..7aa0e7776 100755 --- a/images/macos/provision/core/python.sh +++ b/images/macos/provision/core/python.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh echo "Installing Python Tooling" diff --git a/images/macos/provision/core/reboot.sh b/images/macos/provision/core/reboot.sh index a6e444351..e0a2dfb80 100644 --- a/images/macos/provision/core/reboot.sh +++ b/images/macos/provision/core/reboot.sh @@ -1,2 +1,3 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail + shutdown -r now \ No newline at end of file diff --git a/images/macos/provision/core/ruby.sh b/images/macos/provision/core/ruby.sh index 19877de3e..61eb33c09 100755 --- a/images/macos/provision/core/ruby.sh +++ b/images/macos/provision/core/ruby.sh @@ -1,17 +1,6 @@ -#!/bin/sh - -set -e +#!/bin/bash -e -o pipefail source ~/utils/utils.sh echo Installing Ruby... -if is_Less_BigSur; then - # We can't install latest ruby 2.7 as a default version related with bug - # https://github.com/fastlane/fastlane/issues/15397 - /usr/local/bin/brew install ruby@2.6 - ln -sf /usr/local/opt/ruby\@2.6 /usr/local/opt/ruby -else - brew install ruby -fi - - +brew install ruby diff --git a/images/macos/provision/core/rubygem.sh b/images/macos/provision/core/rubygem.sh index 83639e472..14f4af7a0 100755 --- a/images/macos/provision/core/rubygem.sh +++ b/images/macos/provision/core/rubygem.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh echo Updating RubyGems... diff --git a/images/macos/provision/core/rust.sh b/images/macos/provision/core/rust.sh index 5ef7675ca..de82c7b4a 100644 --- a/images/macos/provision/core/rust.sh +++ b/images/macos/provision/core/rust.sh @@ -1,6 +1,4 @@ -#!/bin/sh - -set -e +#!/bin/bash -e -o pipefail echo Installing Rustup... brew install rustup-init diff --git a/images/macos/provision/core/stack.sh b/images/macos/provision/core/stack.sh index 81b41fa8a..17c5ecd9a 100644 --- a/images/macos/provision/core/stack.sh +++ b/images/macos/provision/core/stack.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail echo "Get the latest Stack version..." StackRelease=$(curl -s "https://api.github.com/repos/commercialhaskell/stack/releases/latest") diff --git a/images/macos/provision/core/toolcache-high-sierra.sh b/images/macos/provision/core/toolcache-high-sierra.sh index 61a3cc8c1..9a67418b3 100644 --- a/images/macos/provision/core/toolcache-high-sierra.sh +++ b/images/macos/provision/core/toolcache-high-sierra.sh @@ -1,7 +1,6 @@ -#!/bin/sh - +#!/bin/bash -e -o pipefail ########################################################################### -# The script downloads macos hosted tool cache for several Python versions +# The script downloads macos hosted tool cache for several Python versions # and installs them onto the system # ########################################################################### diff --git a/images/macos/provision/core/toolcache.sh b/images/macos/provision/core/toolcache.sh index eb6dc905e..dab45debe 100755 --- a/images/macos/provision/core/toolcache.sh +++ b/images/macos/provision/core/toolcache.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail # Download hosted tool cache with npm NPM_FEED="npm.pkg.github.com" diff --git a/images/macos/provision/core/vcpkg.sh b/images/macos/provision/core/vcpkg.sh index 289d7ba49..260f2c2aa 100644 --- a/images/macos/provision/core/vcpkg.sh +++ b/images/macos/provision/core/vcpkg.sh @@ -1,6 +1,5 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail -set -e source ~/utils/utils.sh # Set env variable for vcpkg diff --git a/images/macos/provision/core/vsmac.sh b/images/macos/provision/core/vsmac.sh index 20a8efd46..f0c498fc8 100644 --- a/images/macos/provision/core/vsmac.sh +++ b/images/macos/provision/core/vsmac.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh source ~/utils/xamarin-utils.sh @@ -22,9 +23,6 @@ echo "Moving Visual Studio to /Applications/..." pushd $TMPMOUNT tar cf - "./Visual Studio.app" | tar xf - -C /Applications/ -echo "Launching vstools..." -/Applications/Visual\ Studio.app/Contents/MacOS/vstool - popd sudo hdiutil detach "$TMPMOUNT" sudo rm -rf "$TMPMOUNT" \ No newline at end of file diff --git a/images/macos/provision/core/xamarin-android-ndk.sh b/images/macos/provision/core/xamarin-android-ndk.sh index 35e4d0064..d5b23ebb0 100644 --- a/images/macos/provision/core/xamarin-android-ndk.sh +++ b/images/macos/provision/core/xamarin-android-ndk.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh ANDROID_HOME=$HOME/Library/Android/sdk diff --git a/images/macos/provision/core/xamarin.sh b/images/macos/provision/core/xamarin.sh index 0f0801d7b..86dc1a0fe 100755 --- a/images/macos/provision/core/xamarin.sh +++ b/images/macos/provision/core/xamarin.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail + source ~/utils/utils.sh source ~/utils/xamarin-utils.sh @@ -63,8 +64,10 @@ createBundleLink $CURRENT_SDK_SYMLINK "Current" # Fix nuget in some mono versions because of known bugs # -# Fix Mono issue with default nuget: https://github.com/mono/mono/issues/17637 -installNuget "6.4.0" "5.3.1" +if is_Less_BigSur; then + # Fix Mono issue with default nuget: https://github.com/mono/mono/issues/17637 + installNuget "6.4.0" "5.3.1" +fi if is_Less_Catalina; then installNuget "4.8.1" "4.3.0" diff --git a/images/macos/provision/core/xcode-postbuild.sh b/images/macos/provision/core/xcode-postbuild.sh index bf7ba387e..6afd42c21 100644 --- a/images/macos/provision/core/xcode-postbuild.sh +++ b/images/macos/provision/core/xcode-postbuild.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/bin/bash -e -o pipefail source ~/utils/utils.sh XCODE_LIST=($(get_xcode_list_from_toolset)) DEFAULT_XCODE_VERSION=$(get_default_xcode_from_toolset) # https://github.com/microsoft/appcenter/issues/847 -# Assets.xcassets : error : CoreData: error: (6922) I/O error for database +# Assets.xcassets : error : CoreData: error: (6922) I/O error for database # at $HOME/Library/Developer/Xcode/UserData/IB Support/Simulator Devices/{GUID} echo "Erase a device's contents and settings:" for XCODE_VERSION in "${XCODE_LIST[@]}" @@ -15,6 +15,11 @@ do #add sleep to let CoreSimulatorService to exit sleep 3 + # Version 12.2_beta installed into 12.2 directory and 12.1_GM_seed in 12.1 + pattern="[0-9]{1,2}.*_" + if [[ $XCODE_VERSION =~ $pattern ]] ; then + XCODE_VERSION=$(echo $XCODE_VERSION | cut -d"_" -f 1) + fi # Select xcode version by default sudo xcode-select -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer" diff --git a/images/macos/provision/core/xcode-sims.sh b/images/macos/provision/core/xcode-sims.sh index fb2af5d41..8dff14a5e 100755 --- a/images/macos/provision/core/xcode-sims.sh +++ b/images/macos/provision/core/xcode-sims.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail source ~/utils/utils.sh diff --git a/images/macos/provision/core/xcode-tools.sh b/images/macos/provision/core/xcode-tools.sh index 643dc2932..773b07a95 100755 --- a/images/macos/provision/core/xcode-tools.sh +++ b/images/macos/provision/core/xcode-tools.sh @@ -1,10 +1,8 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail # The script currently requires 2 external variables to be set: XCODE_INSTALL_USER # and XCODE_INSTALL_PASSWORD, in order to access the Apple Developer Center -set -e - source ~/utils/utils.sh source ~/utils/xcode-utils.sh diff --git a/images/macos/provision/utils/utils.sh b/images/macos/provision/utils/utils.sh index 7428c9005..d2c393177 100755 --- a/images/macos/provision/utils/utils.sh +++ b/images/macos/provision/utils/utils.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + download_with_retries() { # Due to restrictions of bash functions, positional arguments are used here. # In case if you using latest argument NAME, you should also set value to all previous parameters. diff --git a/images/macos/provision/utils/xamarin-utils.sh b/images/macos/provision/utils/xamarin-utils.sh index dd6d7ae95..1017cec24 100644 --- a/images/macos/provision/utils/xamarin-utils.sh +++ b/images/macos/provision/utils/xamarin-utils.sh @@ -1,11 +1,11 @@ -#!/bin/sh +#!/bin/bash -e -o pipefail # Xamarin can clean their SDKs while updating to newer versions, # so we should be able to detect it during image generation downloadAndInstallPKG() { local PKG_URL=$1 local PKG_NAME=${PKG_URL##*/} - + download_with_retries $PKG_URL echo "Installing $PKG_NAME..." @@ -159,7 +159,7 @@ installNunitConsole() { local MONO_VERSION=$1 cat < ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} -#!/bin/sh +#!/bin/bash -e -o pipefail exec /Library/Frameworks/Mono.framework/Versions/${MONO_VERSION}/bin/mono --debug \$MONO_OPTIONS $NUNIT3_PATH/nunit3-console.exe "\$@" EOF sudo chmod +x ${TMPMOUNT}/${NUNIT3_CONSOLE_BIN} @@ -180,7 +180,7 @@ downloadNUnitConsole() { echo "Installing NUnit 3..." sudo unzip nunit3.zip -d $NUNIT3_PATH NUNIT3_CONSOLE_BIN=nunit3-console - + popd } diff --git a/images/macos/provision/utils/xcode-utils.sh b/images/macos/provision/utils/xcode-utils.sh index 7cd63b2fc..cfe934398 100644 --- a/images/macos/provision/utils/xcode-utils.sh +++ b/images/macos/provision/utils/xcode-utils.sh @@ -1,3 +1,5 @@ +#!/bin/bash -e -o pipefail + createXamarinProvisionatorSymlink() { local XCODE_VERSION="$1" local FULL_VERSION=$(echo "${XCODE_VERSION}.0.0" | cut -d'.' -f 1,2,3)