Skip to content

Commit d4f6993

Browse files
[macos] skip Sonoma updates for Monterey (#8985)
1 parent 6130ddb commit d4f6993

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

images.CI/macos/anka/CreateCleanAnkaTemplate.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ function Invoke-SoftwareUpdate {
100100
$command = "sw_vers"
101101
$guestMacosVersion = Invoke-SSHPassCommand -HostName $ipAddress -Command $command
102102
switch -regex ($guestMacosVersion[1]) {
103-
'12.\d' { $nextOSVersion = 'macOS Ventura' }
103+
'12.\d' { $nextOSVersion = 'macOS Ventura|macOS Sonoma' }
104104
'13.\d' { $nextOSVersion = 'macOS Sonoma' }
105105
}
106106
# Make an array of updates
107107
$listOfNewUpdates = $newUpdates.split('*').Trim('')
108108
foreach ($newupdate in $listOfNewUpdates) {
109109
# Will be True if the value is not Venture, not empty, and contains "Action: restart" words
110-
if ($newupdate.Contains("Action: restart") -and !$newupdate.Contains("$nextOSVersion") -and (-not [String]::IsNullOrEmpty($newupdate))) {
110+
if ($newupdate.Contains("Action: restart") -and !($newupdate -match $nextOSVersion) -and (-not [String]::IsNullOrEmpty($newupdate))) {
111111
Write-Host "`t[*] Sleep 120 seconds before the software updates have been installed"
112112
Start-Sleep -Seconds 120
113113

@@ -119,7 +119,7 @@ function Invoke-SoftwareUpdate {
119119

120120
# Check software updates have been installed
121121
$updates = Get-SoftwareUpdate -HostName $ipAddress
122-
if ($updates.Contains("Action: restart") -and !$updates.Contains("$nextOSVersion")) {
122+
if ($updates.Contains("Action: restart") -and !($newupdate -match $nextOSVersion)) {
123123
Write-Host "`t[x] Software updates failed to install: "
124124
Show-StringWithFormat $updates
125125
exit 1

0 commit comments

Comments
 (0)