mirror of
https://github.com/actions/runner-images.git
synced 2026-01-05 01:35:22 +08:00
[Anka] Clear LastRecommendedMajorOSBundleIdentifier property (#4675)
* clear LastRecommendedMajorOSBundleIdentifier property * remove property
This commit is contained in:
committed by
GitHub
parent
4828764ba0
commit
57cf70f791
@@ -93,6 +93,10 @@ function Get-MacOSInstaller {
|
||||
sudo rm -rf "$previousInstallerPath"
|
||||
}
|
||||
|
||||
# Clear LastRecommendedMajorOSBundleIdentifier to prevent error during fetching updates
|
||||
# Install failed with error: Update not found
|
||||
Update-SoftwareBundle
|
||||
|
||||
# Download macOS installer
|
||||
Write-Host "`t[*] Requested macOS '$MacOSVersion' version installer found, fetching it from Apple Software Update"
|
||||
$result = Invoke-WithRetry { /usr/sbin/softwareupdate --fetch-full-installer --full-installer-version $MacOSVersion } {$LASTEXITCODE -eq 0} | Out-String
|
||||
@@ -324,3 +328,12 @@ function Wait-LoginWindow {
|
||||
}
|
||||
Invoke-WithRetry -RetryCount $RetryCount -Seconds $Seconds -BreakCondition $condition
|
||||
}
|
||||
|
||||
function Update-SoftwareBundle {
|
||||
$productVersion = sw_vers -productVersion
|
||||
|
||||
if ( $productVersion.StartsWith('11.') ) {
|
||||
sudo rm -rf /Library/Preferences/com.apple.commerce.plist
|
||||
sudo /usr/bin/defaults delete /Library/Preferences/com.apple.SoftwareUpdate.plist LastRecommendedMajorOSBundleIdentifier | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user