6
6
7
7
source ~ /utils/utils.sh
8
8
9
- # Set solid color wallpaper
9
+ echo " Set solid color wallpaper"
10
10
osascript -e ' tell application "Finder" to set desktop picture to POSIX file "/System/Library/Desktop Pictures/Solid Colors/Black.png"'
11
11
12
- # Close all finder windows because they can interfere with UI tests
12
+ echo " Close all finder windows because they can interfere with UI tests"
13
13
close_finder_window
14
14
15
- # Disable Handoff and Continuity
15
+ echo " Disable Handoff and Continuity"
16
16
defaults write com.apple.coreservices.useractivityd ActivityReceivingEnabled -bool false
17
17
defaults write com.apple.coreservices.useractivityd ActivityAdvertisingAllowed -bool false
18
18
19
- # Disable graphic effects in System
19
+ echo " Disable graphic effects in System"
20
20
defaults write com.apple.universalaccess reduceMotion -bool true
21
21
defaults write com.apple.universalaccess reduceTransparency -bool true
22
22
23
- # Disable analytics daemon (requires SIP to be disabled)
23
+ echo " Disable analytics daemon (requires SIP to be disabled)"
24
24
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.SubmitDiagInfo.plist
25
25
26
- # Disable notification center agent
26
+ echo " Disable notification center agent"
27
27
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
28
28
29
- # Disable Time Machine and it's daemon
29
+ echo " Disable Time Machine and it's daemon"
30
30
sudo tmutil disable
31
31
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.backupd.plist
32
32
33
- # Disable Apple Push Notification Service daemon
33
+ echo " Disable Apple Push Notification Service daemon"
34
34
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist
35
35
36
36
# Remove Parallels Desktop
@@ -40,32 +40,66 @@ if is_SonomaX64 || is_VenturaX64 || is_SequoiaX64; then
40
40
brew uninstall parallels
41
41
fi
42
42
43
- # Put documentation to $HOME root
43
+ echo " Put documentation to $HOME root"
44
44
cp $HOME /image-generation/output/software-report/systeminfo.* $HOME /
45
45
46
- # Remove fastlane cached cookie
46
+ echo " Remove fastlane cached cookie"
47
47
rm -rf ~ /.fastlane
48
48
49
49
# Clean up npm cache which collected during image-generation
50
50
# we have to do that here because `npm install` is run in a few different places during image-generation
51
+ echo " Clean up npm cache"
51
52
npm cache clean --force
52
53
53
54
# Clean yarn cache
54
55
yarn cache clean
55
56
56
- # Clean up temporary directories
57
+ echo " Clean up temporary directories"
57
58
sudo rm -rf ~ /utils /tmp/*
58
59
59
60
# Erase all indexes and wait until the rebuilding process ends,
60
- # for now there is no way to get status of indexing process, it takes around 5 minutes to accomplish
61
- sudo mdutil -E /
62
- sudo log stream | grep -q -E ' mds.*Released.*BackgroundTask' || true
63
- echo " Indexing completed"
64
-
65
- # delete symlink for tests running
61
+ # for now there is no clear way to get status of indexing process on macOS, it takes around 3-6 minutes to accomplish
62
+ echo " Erase all MDS indexes and wait until the rebuilding process ends"
63
+ sudo mdutil -E / > /dev/null
64
+
65
+ echo " Wait for 6 minutes or until the indexing process end signal is found in logs"
66
+ for _ in {1..12}; do
67
+ sleep 30
68
+ result=$( sudo log show --last 1m | grep -E ' mds.*Released.*BackgroundTask' || true)
69
+ if [[ -n " $result " ]]; then
70
+ echo " Sign of indexing completion found:"
71
+ echo " $result "
72
+ break
73
+ fi
74
+ done
75
+
76
+ echo " Check if the indexing process or other CPU intensive process (5% and more) is still running"
77
+
78
+ cool=0
79
+ while true ; do
80
+ usage=$( top -l 2 | grep " CPU usage" | awk ' {print int($3)}' | tr -d ' %' | tail -n 1)
81
+ echo " Current CPU usage: ${usage} %"
82
+ if [ $usage -lt 5 ]; then
83
+ cool=$(( cool + 1 ))
84
+ else
85
+ ps -arcwwwxo ppid,pid,%cpu,%mem,time,command | head -n 2 || true
86
+ cool=0
87
+ fi
88
+
89
+ echo " Feeling cool for $cool intervals"
90
+
91
+ if [ $cool -gt 5 ]; then
92
+ echo " Cooled down, exiting..."
93
+ break
94
+ fi
95
+
96
+ sleep 1
97
+ done
98
+
99
+ echo " Delete symlink for tests running"
66
100
sudo rm -f /usr/local/bin/invoke_tests
67
101
68
- # Clean Homebrew downloads
102
+ echo " Clean Homebrew downloads"
69
103
sudo rm -rf /Users/$USER /Library/Caches/Homebrew/downloads/*
70
104
71
105
# Uninstall expect used in configure-machine.sh
0 commit comments