mirror of
https://github.com/actions/runner-images.git
synced 2025-12-24 10:28:00 +08:00
Fix macOS 13 arm64 software update part (#8772)
Co-authored-by: Alexey Ayupov <“alexey.ayupov@akvelon.com”>
This commit is contained in:
@@ -96,13 +96,20 @@ function Invoke-SoftwareUpdate {
|
||||
Install-SoftwareUpdate -HostName $ipAddress -listOfUpdates $listOfNewUpdates -Password $Password | Show-StringWithFormat
|
||||
|
||||
# Check if Action: restart
|
||||
# Define the next macOS version
|
||||
$command = "sw_vers"
|
||||
$guestMacosVersion = Invoke-SSHPassCommand -HostName $ipAddress -Command $command
|
||||
switch -regex ($guestMacosVersion[1]) {
|
||||
'12.\d' { $nextOSVersion = 'macOS Ventura' }
|
||||
'13.\d' { $nextOSVersion = 'macOS Sonoma' }
|
||||
}
|
||||
# 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 !$newupdate.Contains("macOS Sonoma") -and (-not [String]::IsNullOrEmpty($newupdate))) {
|
||||
Write-Host "`t[*] Sleep 60 seconds before the software updates have been installed"
|
||||
Start-Sleep -Seconds 60
|
||||
if ($newupdate.Contains("Action: restart") -and !$newupdate.Contains("$nextOSVersion") -and (-not [String]::IsNullOrEmpty($newupdate))) {
|
||||
Write-Host "`t[*] Sleep 120 seconds before the software updates have been installed"
|
||||
Start-Sleep -Seconds 120
|
||||
|
||||
Write-Host "`t[*] Waiting for loginwindow process"
|
||||
Wait-LoginWindow -HostName $ipAddress | Show-StringWithFormat
|
||||
@@ -112,7 +119,7 @@ function Invoke-SoftwareUpdate {
|
||||
|
||||
# Check software updates have been installed
|
||||
$updates = Get-SoftwareUpdate -HostName $ipAddress
|
||||
if ($updates.Contains("Action: restart")) {
|
||||
if ($updates.Contains("Action: restart") -and !$updates.Contains("$nextOSVersion")) {
|
||||
Write-Host "`t[x] Software updates failed to install: "
|
||||
Show-StringWithFormat $updates
|
||||
exit 1
|
||||
@@ -123,6 +130,10 @@ function Invoke-SoftwareUpdate {
|
||||
Write-Host "`t[*] Show the install history:"
|
||||
$hUpdates = Get-SoftwareUpdateHistory -HostName $ipAddress
|
||||
Show-StringWithFormat $hUpdates
|
||||
|
||||
Write-Host "`t[*] The current macOS version:"
|
||||
$command = "sw_vers"
|
||||
Invoke-SSHPassCommand -HostName $ipAddress -Command $command | Show-StringWithFormat
|
||||
}
|
||||
|
||||
function Invoke-UpdateSettings {
|
||||
|
||||
Reference in New Issue
Block a user