Files
runner-images/images/macos/provision/configuration/finalize-vm.sh
T

43 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
2020-09-10 14:34:08 +03:00
# Close all finder windows because they can interfere with UI tests
osascript -e 'tell application "Finder" to close windows'
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
2020-09-10 14:34:08 +03:00
fi
# Put documentation to $HOME root
cp $HOME/image-generation/output/software-report/systeminfo.txt $HOME/image-generation/output/software-report/systeminfo.md $HOME/
2020-09-21 17:16:22 +03:00
# Put build vm assets scripts to proper directory
2020-10-27 18:36:59 +03:00
mkdir -p /usr/local/opt/$USER/scripts
2020-09-21 17:16:22 +03:00
mv $HOME/image-generation/assets/* /usr/local/opt/$USER/scripts
2020-09-23 14:13:02 +03:00
find /usr/local/opt/$USER/scripts -type f -name "*\.sh" -exec chmod +x {} \;
2020-09-23 13:30:07 +03:00
2020-09-10 14:34:08 +03:00
# Clean up npm cache which collected during image-generation
# we have to do that here because `npm install` is run in a few different places during image-generation
npm cache clean --force
2020-10-27 17:54:16 +03:00
# Clean yarn cache
yarn cache clean
2020-09-10 14:34:08 +03:00
# Clean up temporary directories
2020-11-10 12:44:58 +03:00
sudo rm -rf ~/utils ~/image-generation /tmp/*
2020-10-21 16:09:53 +03:00
# Erase all indexes and wait until the rebuilding process ends,
# for now there is no way to get status of indexing process, it takes around 3 minutes to accomplish
sudo mdutil -E /
2020-10-29 09:19:29 +03:00
sudo log stream | grep -q -E 'mds.*Released.*BackgroundTask' || true
echo "Indexing completed"
# delete symlink for tests running
sudo rm -f /usr/local/bin/invoke_tests