Skip to content

Commit

Permalink
[macOS] Update base image generation to work with Sequoia updates (ac…
Browse files Browse the repository at this point in the history
…tions#10651)

Co-authored-by: sarathrajsrinivasan <[email protected]>
  • Loading branch information
2 people authored and Water-Melon committed Sep 25, 2024
1 parent 6d0330f commit d63f81b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions images.CI/macos/anka/CreateCleanAnkaTemplate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ function Invoke-SoftwareUpdate {
$command = "sw_vers"
$guestMacosVersion = Invoke-SSHPassCommand -HostName $ipAddress -Command $command
switch -regex ($guestMacosVersion[1]) {
'12.\d' { $nextOSVersion = 'macOS Ventura|macOS Sonoma' }
'13.\d' { $nextOSVersion = 'macOS Sonoma' }
'12.\d' { $nextOSVersion = 'macOS Ventura|macOS Sonoma|macOS Sequoia' }
'13.\d' { $nextOSVersion = 'macOS Sonoma|macOS Sequoia' }
'14.\d' { $nextOSVersion = 'macOS Sequoia' }
}

Write-Host "`t[*] Fetching Software Updates ready to install on '$TemplateName' VM:"
Expand Down
9 changes: 5 additions & 4 deletions images.CI/macos/anka/Service.Helpers.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ function Invoke-SoftwareUpdateArm64 {
$command = "sw_vers"
$guestMacosVersion = Invoke-SSHPassCommand -HostName $HostName -Command $command
switch -regex ($guestMacosVersion[1]) {
'13.\d' { $nextOSVersion = 'Sonoma' }
'14.\d' { $nextOSVersion = 'NotYetDefined' }
'12.\d' { $nextOSVersion = 'macOS Ventura|macOS Sonoma|macOS Sequoia' }
'13.\d' { $nextOSVersion = 'macOS Sonoma|macOS Sequoia' }
'14.\d' { $nextOSVersion = 'macOS Sequoia' }
}

$url = "https://raw.githubusercontent.com/actions/runner-images/main/images/macos/assets/auto-software-update-arm64.exp"
$script = Invoke-RestMethod -Uri $url
foreach ($update in $listOfUpdates) {
if ($update -notmatch "$nextOSVersion") {
foreach ($update in $ListOfUpdates) {
if ($update -notmatch $nextOSVersion) {
$updatedScript = $script.Replace("MACOSUPDATE", $($($update.trim()).Replace(" ","\ ")))
$base64 = [Convert]::ToBase64String($updatedScript.ToCharArray())
$command = "echo $base64 | base64 --decode > ./auto-software-update-arm64.exp;chmod +x ./auto-software-update-arm64.exp; ./auto-software-update-arm64.exp ${Password};rm ./auto-software-update-arm64.exp"
Expand Down

0 comments on commit d63f81b

Please sign in to comment.