diff --git a/images/macos/scripts/build/configure-system.sh b/images/macos/scripts/build/configure-system.sh index 32d64367b..12545c7b4 100644 --- a/images/macos/scripts/build/configure-system.sh +++ b/images/macos/scripts/build/configure-system.sh @@ -11,7 +11,8 @@ close_finder_window # Remove Parallels Desktop # https://github.com/actions/runner-images/issues/6105 -if is_Monterey; then +# https://github.com/actions/runner-images/issues/10143 +if is_Monterey || is_SonomaX64 || is_VenturaX64; then brew uninstall parallels fi diff --git a/images/macos/scripts/build/install-common-utils.sh b/images/macos/scripts/build/install-common-utils.sh index cd0eab214..46e0fb01f 100644 --- a/images/macos/scripts/build/install-common-utils.sh +++ b/images/macos/scripts/build/install-common-utils.sh @@ -30,24 +30,38 @@ for package in $cask_packages; do virtualbox_cask_path=$(download_with_retry "https://raw.githubusercontent.com/Homebrew/homebrew-cask/aa3c55951fc9d687acce43e5c0338f42c1ddff7b/Casks/virtualbox.rb") brew install $virtualbox_cask_path else - brew install --cask $package + if is_Arm64 && [[ $package == "parallels" ]]; then + echo "Parallels installation is skipped for arm64 architecture" + else + brew install --cask $package + fi fi done # Load "Parallels International GmbH" -if is_Monterey; then +if is_Monterey || is_SonomaX64 || is_VenturaX64; then sudo kextload /Applications/Parallels\ Desktop.app/Contents/Library/Extensions/10.9/prl_hypervisor.kext || true fi -# Execute AppleScript to change security preferences +# Execute AppleScript to change security preferences for macOS12, macOS13 and macOS14 # System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now -if is_Monterey; then +if is_Monterey || is_SonomaX64 || is_VenturaX64; then for retry in {4..0}; do echo "Executing AppleScript to change security preferences. Retries left: $retry" { set -e osascript -e 'tell application "System Events" to get application processes where visible is true' - osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD + if is_Monterey; then + osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD + fi + + if is_VenturaX64; then + osascript $HOME/utils/confirm-identified-developers-macos13.scpt $USER_PASSWORD + fi + + if is_SonomaX64; then + osascript $HOME/utils/confirm-identified-developers-macos14.scpt $USER_PASSWORD + fi } && break if [[ $retry -eq 0 ]]; then @@ -61,9 +75,17 @@ if is_Monterey; then fi # Validate "Parallels International GmbH" kext -if is_Monterey; then - echo "Closing System Preferences window if it is still opened" - killall "System Preferences" || true +if is_Monterey || is_SonomaX64 || is_VenturaX64; then + + if is_Monterey; then + echo "Closing System Preferences window if it is still opened" + killall "System Preferences" || true + fi + + if is_SonomaX64 || is_VenturaX64; then + echo "Closing System Settings window if it is still opened" + killall "System Settings" || true + fi echo "Checking parallels kexts" dbName="/var/db/SystemPolicyConfiguration/KextPolicy" diff --git a/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 b/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 index 0effe1e54..ff3bb0118 100644 --- a/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 +++ b/images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 @@ -290,7 +290,13 @@ if ($os.IsMonterey) { $miscellaneous.AddToolVersion("Zlib", $(Get-ZlibVersion)) } -if ($os.IsMonterey) { +if ($os.IsSonomaX64 -or $os.IsVenturaX64) { + $miscellaneous = $installedSoftware.AddHeader("Miscellaneous") +} +if ($os.IsMonterey -or $os.IsSonomaX64 -or $os.IsVenturaX64) { + + Write-Host "Adding environment variables for parallels" + $miscellaneousEnv = $miscellaneous.AddHeader("Environment variables") $miscellaneousEnv.AddTable($(Build-MiscellaneousEnvironmentTable)) diff --git a/images/macos/scripts/helpers/confirm-identified-developers-macos13.scpt b/images/macos/scripts/helpers/confirm-identified-developers-macos13.scpt new file mode 100644 index 000000000..6ab835141 --- /dev/null +++ b/images/macos/scripts/helpers/confirm-identified-developers-macos13.scpt @@ -0,0 +1,34 @@ +# This AppleScript clicks "Allow" for "System Software from developer "Parallels International GmbH" +# Steps: +# - Open System Settings -> Privacy & Security +# - Click 'Allow' for 'System Software from developer "Parallels International GmbH' +# - Enter password for runner + +on run argv + set userpassword to item 1 of argv + + tell application "System Settings" + activate + delay 5 + end tell + + tell application "System Events" + tell process "System Settings" + set frontmost to true + repeat until exists window 1 + delay 2 + end repeat + + tell splitter group 1 of group 1 of window 1 + select row 20 of outline 1 of scroll area 1 of group 1 + delay 5 + click UI Element 2 of group 4 of scroll area 1 of group 1 of group 2 + delay 5 + keystroke userpassword + delay 5 + keystroke return + delay 5 + end tell + end tell + end tell +end run diff --git a/images/macos/scripts/helpers/confirm-identified-developers-macos14.scpt b/images/macos/scripts/helpers/confirm-identified-developers-macos14.scpt new file mode 100644 index 000000000..4c192335a --- /dev/null +++ b/images/macos/scripts/helpers/confirm-identified-developers-macos14.scpt @@ -0,0 +1,34 @@ +# This AppleScript clicks "Allow" for "System Software from developer "Parallels International GmbH" +# Steps: +# - Open System Settings -> Privacy & Security +# - Click 'Allow' for 'System Software from developer "Parallels International GmbH' +# - Enter password for runner + +on run argv + set userpassword to item 1 of argv + + tell application "System Settings" + activate + delay 5 + end tell + + tell application "System Events" + tell process "System Settings" + set frontmost to true + repeat until exists window 1 + delay 2 + end repeat + + tell splitter group 1 of group 1 of window 1 + select row 18 of outline 1 of scroll area 1 of group 1 + delay 5 + click UI Element 2 of group 5 of scroll area 1 of group 1 of group 2 + delay 5 + keystroke userpassword + delay 5 + keystroke return + delay 5 + end tell + end tell + end tell +end run diff --git a/images/macos/templates/macOS-13.anka.pkr.hcl b/images/macos/templates/macOS-13.anka.pkr.hcl index 7d003d3ec..c3587434a 100644 --- a/images/macos/templates/macOS-13.anka.pkr.hcl +++ b/images/macos/templates/macOS-13.anka.pkr.hcl @@ -157,7 +157,7 @@ build { "mv ${local.image_folder}/docs-gen ${local.image_folder}/software-report", "mv ${local.image_folder}/xamarin-selector ${local.image_folder}/assets", "mkdir ~/utils", - "mv ${local.image_folder}/helpers/confirm-identified-developers.scpt ~/utils", + "mv ${local.image_folder}/helpers/confirm-identified-developers-macos13.scpt ~/utils", "mv ${local.image_folder}/helpers/invoke-tests.sh ~/utils", "mv ${local.image_folder}/helpers/utils.sh ~/utils", "mv ${local.image_folder}/helpers/xamarin-utils.sh ~/utils" diff --git a/images/macos/templates/macOS-14.anka.pkr.hcl b/images/macos/templates/macOS-14.anka.pkr.hcl index 1dc266035..638388f10 100644 --- a/images/macos/templates/macOS-14.anka.pkr.hcl +++ b/images/macos/templates/macOS-14.anka.pkr.hcl @@ -157,7 +157,7 @@ build { "mv ${local.image_folder}/docs-gen ${local.image_folder}/software-report", "mv ${local.image_folder}/xamarin-selector ${local.image_folder}/assets", "mkdir ~/utils", - "mv ${local.image_folder}/helpers/confirm-identified-developers.scpt ~/utils", + "mv ${local.image_folder}/helpers/confirm-identified-developers-macos14.scpt ~/utils", "mv ${local.image_folder}/helpers/invoke-tests.sh ~/utils", "mv ${local.image_folder}/helpers/utils.sh ~/utils", "mv ${local.image_folder}/helpers/xamarin-utils.sh ~/utils" diff --git a/images/macos/toolsets/toolset-13.json b/images/macos/toolsets/toolset-13.json index 23a98ef1e..33b6ca65b 100644 --- a/images/macos/toolsets/toolset-13.json +++ b/images/macos/toolsets/toolset-13.json @@ -82,7 +82,7 @@ "xcodes" ], "cask_packages": [ - "" + "parallels" ] }, "gcc": { diff --git a/images/macos/toolsets/toolset-14.json b/images/macos/toolsets/toolset-14.json index dcc3833e4..d2c867492 100644 --- a/images/macos/toolsets/toolset-14.json +++ b/images/macos/toolsets/toolset-14.json @@ -85,7 +85,7 @@ "xcodes" ], "cask_packages": [ - "" + "parallels" ] }, "gcc": {