[Anka] Clear LastRecommendedMajorOSBundleIdentifier property (#4675)
* clear LastRecommendedMajorOSBundleIdentifier property * remove property
This commit is contained in:
@@ -93,6 +93,10 @@ function Get-MacOSInstaller {
|
|||||||
sudo rm -rf "$previousInstallerPath"
|
sudo rm -rf "$previousInstallerPath"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Clear LastRecommendedMajorOSBundleIdentifier to prevent error during fetching updates
|
||||||
|
# Install failed with error: Update not found
|
||||||
|
Update-SoftwareBundle
|
||||||
|
|
||||||
# Download macOS installer
|
# Download macOS installer
|
||||||
Write-Host "`t[*] Requested macOS '$MacOSVersion' version installer found, fetching it from Apple Software Update"
|
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
|
$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
|
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