diff --git a/images/macos/provision/configuration/finalize-vm.sh b/images/macos/provision/configuration/finalize-vm.sh index 6770cef5f..c3d72b7a8 100644 --- a/images/macos/provision/configuration/finalize-vm.sh +++ b/images/macos/provision/configuration/finalize-vm.sh @@ -13,6 +13,12 @@ if is_Catalina; then fi fi +# Remove Parallels Desktop +# https://github.com/actions/runner-images/issues/6105 +if is_Monterey; then + brew uninstall parallels +fi + # Put documentation to $HOME root cp $HOME/image-generation/output/software-report/systeminfo.txt $HOME/image-generation/output/software-report/systeminfo.md $HOME/ diff --git a/images/macos/provision/core/commonutils.sh b/images/macos/provision/core/commonutils.sh index 75639dcd3..5ec148514 100644 --- a/images/macos/provision/core/commonutils.sh +++ b/images/macos/provision/core/commonutils.sh @@ -16,7 +16,12 @@ for package in $cask_packages; do brew install --cask $package done -# Execute AppleScript to change security preferences for virtualbox +# Load "Parallels International GmbH" +if is_Monterey; then + sudo kextload /Applications/Parallels\ Desktop.app/Contents/Library/Extensions/10.9/prl_hypervisor.kext || true +fi + +# Execute AppleScript to change security preferences # System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now if is_Monterey; then if is_Veertu; then @@ -38,6 +43,26 @@ if is_Monterey; then osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD fi +# Validate "Parallels International GmbH" kext +if is_Monterey; then + dbName="/var/db/SystemPolicyConfiguration/KextPolicy" + dbQuery="SELECT * FROM kext_policy WHERE bundle_id LIKE 'com.parallels.kext.%';" + kext=$(sudo sqlite3 $dbName "$dbQuery") + + if [ -z "$kext" ]; then + echo "Parallels International GmbH not found" + exit 1 + fi + + # Create env variable + url=$(brew info --json=v2 --installed | jq -r '.casks[] | select(.name[] == "Parallels Desktop").url') + if [ -z "$url" ]; then + echo "Unable to parse url for Parallels Desktop cask" + exit 1 + fi + echo "export PARALLELS_DMG_URL=$url" >> "${HOME}/.bashrc" +fi + # Invoke bazel to download bazel version via bazelisk bazel diff --git a/images/macos/provision/utils/confirm-identified-developers.scpt b/images/macos/provision/utils/confirm-identified-developers.scpt index a445d8be1..31a650d76 100644 --- a/images/macos/provision/utils/confirm-identified-developers.scpt +++ b/images/macos/provision/utils/confirm-identified-developers.scpt @@ -12,17 +12,13 @@ on run argv set userpassword to item 1 of argv set secpane to "Security & Privacy" - tell application "System Events" - tell security preferences - keystroke return - delay 5 - end tell - end tell - activate application "System Preferences" delay 5 + tell application "System Events" tell process "System Preferences" + set frontmost to true + delay 2 click menu item secpane of menu "View" of menu bar 1 delay 5 click button 1 of window 1 diff --git a/images/macos/software-report/SoftwareReport.Common.psm1 b/images/macos/software-report/SoftwareReport.Common.psm1 index 2012f889c..01955e019 100644 --- a/images/macos/software-report/SoftwareReport.Common.psm1 +++ b/images/macos/software-report/SoftwareReport.Common.psm1 @@ -575,6 +575,20 @@ function Build-PackageManagementEnvironmentTable { } } +function Build-MiscellaneousEnvironmentTable { + return @( + @{ + "Name" = "PARALLELS_DMG_URL" + "Value" = $env:PARALLELS_DMG_URL + } + ) | ForEach-Object { + [PSCustomObject] @{ + "Name" = $_.Name + "Value" = $_.Value + } + } +} + function Get-GraalVMVersion { $version = & "$env:GRAALVM_11_ROOT\java" --version | Select-String -Pattern "GraalVM" | Take-Part -Part 5,6 return $version diff --git a/images/macos/software-report/SoftwareReport.Generator.ps1 b/images/macos/software-report/SoftwareReport.Generator.ps1 index 3169e4338..433b4ec31 100644 --- a/images/macos/software-report/SoftwareReport.Generator.ps1 +++ b/images/macos/software-report/SoftwareReport.Generator.ps1 @@ -309,6 +309,21 @@ $markdown += New-MDList -Style Unordered -Lines (@( ) | Sort-Object ) +if ($os.IsMonterey) { +$markdown += New-MDHeader "Environment variables" -Level 4 +$markdown += Build-MiscellaneousEnvironmentTable | New-MDTable +$markdown += New-MDNewLine + +$markdown += New-MDHeader "Notes:" -Level 5 +$misc = @' +``` +If you want to use Parallels Desktop you should download a package from URL stored in +PARALLELS_DMG_URL environment variable. A system extension is allowed for this version. +``` +'@ +$markdown += New-MDParagraph -Lines $misc +} + # # Generate systeminfo.txt with information about image (for debug purpose) # diff --git a/images/macos/toolsets/toolset-12.json b/images/macos/toolsets/toolset-12.json index b45343442..d69b6e1d2 100644 --- a/images/macos/toolsets/toolset-12.json +++ b/images/macos/toolsets/toolset-12.json @@ -181,7 +181,8 @@ "cask_packages": [ "julia", "vagrant", - "virtualbox" + "virtualbox", + "parallels" ] }, "gcc": {