From a67e67d42ecac54c57d53484129e7f24d58e81db Mon Sep 17 00:00:00 2001 From: Alexey-Ayupov <116575425+Alexey-Ayupov@users.noreply.github.com> Date: Fri, 28 Apr 2023 10:35:14 +0200 Subject: [PATCH] Add exclusion for macOS-12 for Action: restart (#7511) --- .../macos/anka/CreateCleanAnkaTemplate.ps1 | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 b/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 index 634734b69..6c3a90508 100644 --- a/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 +++ b/images.CI/macos/anka/CreateCleanAnkaTemplate.ps1 @@ -86,22 +86,27 @@ function Invoke-SoftwareUpdate { Install-SoftwareUpdate -HostName $ipAddress -listOfUpdates $listOfNewUpdates | Show-StringWithFormat # Check if Action: restart - if ($newUpdates.Contains("Action: restart")) { - Write-Host "`t[*] Sleep 60 seconds before the software updates have been installed" - Start-Sleep -Seconds 60 + # Make an array of updates + $listOfNewUpdates = $newUpdates.split('*').Trim('') + foreach ($newupdate in $listOfNewUpdates) { + # Will be True if the value is not Venture, not empty, and contains "Action: restart" words + if ($newupdate.Contains("Action: restart") -and !$newupdate.Contains("macOS Ventura") -and (-not [String]::IsNullOrEmpty($newupdate))) { + Write-Host "`t[*] Sleep 60 seconds before the software updates have been installed" + Start-Sleep -Seconds 60 - Write-Host "`t[*] Waiting for loginwindow process" - Wait-LoginWindow -HostName $ipAddress | Show-StringWithFormat + Write-Host "`t[*] Waiting for loginwindow process" + Wait-LoginWindow -HostName $ipAddress | Show-StringWithFormat - # Re-enable AutoLogon after installing a new security software update - Invoke-EnableAutoLogon + # Re-enable AutoLogon after installing a new security software update + Invoke-EnableAutoLogon - # Check software updates have been installed - $updates = Get-SoftwareUpdate -HostName $ipAddress - if ($updates.Contains("Action: restart")) { - Write-Host "`t[x] Software updates failed to install: $updates" - Show-StringWithFormat $updates - exit 1 + # Check software updates have been installed + $updates = Get-SoftwareUpdate -HostName $ipAddress + if ($updates.Contains("Action: restart")) { + Write-Host "`t[x] Software updates failed to install: " + Show-StringWithFormat $updates + exit 1 + } } }