mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 11:37:00 +00:00
[Anka] Exclude upgrade to Sonoma (#8551)
This commit is contained in:
@@ -90,7 +90,7 @@ function Invoke-SoftwareUpdate {
|
||||
|
||||
Write-Host "`t[*] Fetching Software Updates ready to install on '$TemplateName' VM:"
|
||||
Show-StringWithFormat $newUpdates
|
||||
$listOfNewUpdates = $($($newUpdates.Split("*")).Split("Title") | Where-Object {$_ -match "Label:"}).Replace("Label: ", '') | Where-Object {$_ -notmatch "macOS Sonoma"}
|
||||
$listOfNewUpdates = $($($newUpdates.Split("*")).Split("Title") | Where-Object {$_ -match "Label:"}).Replace("Label: ", '')
|
||||
Write-Host "`t[*] Installing Software Updates on '$TemplateName' VM:"
|
||||
Install-SoftwareUpdate -HostName $ipAddress -listOfUpdates $listOfNewUpdates -Password $Password | Show-StringWithFormat
|
||||
|
||||
@@ -99,7 +99,7 @@ function Invoke-SoftwareUpdate {
|
||||
$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") -or !$newupdate.Contains("macOS Sonoma")) -and (-not [String]::IsNullOrEmpty($newupdate))) {
|
||||
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
|
||||
|
||||
|
||||
@@ -244,9 +244,10 @@ function Install-SoftwareUpdate {
|
||||
[array] $listOfUpdates,
|
||||
[string] $Password
|
||||
)
|
||||
$osVersion = [Environment]::OSVersion
|
||||
# If an update is happening on macOS 12 we will use the prepared list of updates, otherwise, we will install all updates.
|
||||
if ($osVersion.Version.Major -eq "12") {
|
||||
# If an update is happening on macOS 12 or 13 we will use the prepared list of updates, otherwise, we will install all updates.
|
||||
$command = "sw_vers"
|
||||
$guestMacosVersion = Invoke-SSHPassCommand -HostName $HostName -Command $command
|
||||
if ($guestMacosVersion[1] -match "12") {
|
||||
foreach ($update in $listOfUpdates){
|
||||
# Filtering updates that contain "Ventura" word
|
||||
if ($update -notmatch "Ventura") {
|
||||
@@ -254,6 +255,14 @@ function Install-SoftwareUpdate {
|
||||
Invoke-SSHPassCommand -HostName $HostName -Command $command
|
||||
}
|
||||
}
|
||||
} elseif ($guestMacosVersion[1] -match "13") {
|
||||
foreach ($update in $listOfUpdates){
|
||||
# Filtering updates that contain "Sonoma" word
|
||||
if ($update -notmatch "Sonoma") {
|
||||
$command = "sudo /usr/sbin/softwareupdate --restart --verbose --install '$($update.trim())'"
|
||||
Invoke-SSHPassCommand -HostName $HostName -Command $command
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$osArch = $(arch)
|
||||
if ($osArch -eq "arm64") {
|
||||
|
||||
Reference in New Issue
Block a user