[macOS] Add Parallels Desktop extension (#6314)

* Add Parallels Desktop extension

* fix typo

* remove new line
This commit is contained in:
Aleksandr Chebotov
2022-09-28 19:06:08 +02:00
committed by GitHub
parent b0885e18a1
commit 3f0a28fe18
6 changed files with 66 additions and 9 deletions

View File

@@ -13,6 +13,12 @@ if is_Catalina; then
fi fi
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 # Put documentation to $HOME root
cp $HOME/image-generation/output/software-report/systeminfo.txt $HOME/image-generation/output/software-report/systeminfo.md $HOME/ cp $HOME/image-generation/output/software-report/systeminfo.txt $HOME/image-generation/output/software-report/systeminfo.md $HOME/

View File

@@ -16,7 +16,12 @@ for package in $cask_packages; do
brew install --cask $package brew install --cask $package
done 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 # System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
if is_Monterey; then if is_Monterey; then
if is_Veertu; then if is_Veertu; then
@@ -38,6 +43,26 @@ if is_Monterey; then
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
fi 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 # Invoke bazel to download bazel version via bazelisk
bazel bazel

View File

@@ -12,17 +12,13 @@ on run argv
set userpassword to item 1 of argv set userpassword to item 1 of argv
set secpane to "Security & Privacy" set secpane to "Security & Privacy"
tell application "System Events"
tell security preferences
keystroke return
delay 5
end tell
end tell
activate application "System Preferences" activate application "System Preferences"
delay 5 delay 5
tell application "System Events" tell application "System Events"
tell process "System Preferences" tell process "System Preferences"
set frontmost to true
delay 2
click menu item secpane of menu "View" of menu bar 1 click menu item secpane of menu "View" of menu bar 1
delay 5 delay 5
click button 1 of window 1 click button 1 of window 1

View File

@@ -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 { function Get-GraalVMVersion {
$version = & "$env:GRAALVM_11_ROOT\java" --version | Select-String -Pattern "GraalVM" | Take-Part -Part 5,6 $version = & "$env:GRAALVM_11_ROOT\java" --version | Select-String -Pattern "GraalVM" | Take-Part -Part 5,6
return $version return $version

View File

@@ -309,6 +309,21 @@ $markdown += New-MDList -Style Unordered -Lines (@(
) | Sort-Object ) | 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) # Generate systeminfo.txt with information about image (for debug purpose)
# #

View File

@@ -181,7 +181,8 @@
"cask_packages": [ "cask_packages": [
"julia", "julia",
"vagrant", "vagrant",
"virtualbox" "virtualbox",
"parallels"
] ]
}, },
"gcc": { "gcc": {