Created
April 10, 2013 13:03
-
-
Save timsutton/5354425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<installation-check script='InstallationCheck()'/> | |
<volume-check script='VolumeCheck()'/> | |
<script> | |
var gCurrentiTunesVersion = '11.0.2'; | |
var gPreviousiTunesVersion = '11.0.1'; // There is no patch for this release we will use the CurrentiTunesVersion value. | |
var gOSMinimumVersion = '10.6.8'; | |
function installMobilitySupport() | |
{ | |
if (system.files.fileExistsAtPath('/tmp/com.apple.mpkg.iTunes.noAMDS')){ | |
return false; | |
} | |
return true; | |
} | |
function InstallationCheck() | |
{ | |
// bypass this check if Software Update is running | |
if ( system.applications.fromIdentifier('com.apple.SoftwareUpdate') ) { | |
return true; | |
} | |
// no Tier 3 language support | |
if ( volumeHasTier3() ) { | |
my.result.title = system.localizedString('T_INST'); | |
my.result.message = system.localizedStringWithFormat('volumeHasTier3'); | |
my.result.type = 'Fatal'; | |
return false; | |
} | |
if(system.compareVersions(system.version.ProductVersion, gOSMinimumVersion) == -1) { | |
my.result.title = system.localizedString('T_INST'); | |
my.result.message = system.localizedStringWithFormat('OS_VER_ERR'); | |
my.result.type = 'Fatal'; | |
return false; | |
} | |
return true; | |
} | |
function VolumeCheck() { | |
if(system.compareVersions(my.target.systemVersion.ProductVersion, gOSMinimumVersion) == -1) { | |
my.result.message = system.localizedString('OS_VER_ERR'); | |
my.result.type = 'Fatal'; | |
return false; | |
} | |
// do not downgrade | |
var plist = system.files.plistAtPath("/Applications/iTunes.app/Contents/Info.plist"); | |
if ( !plist || plist.CFBundleShortVersionString && (system.compareVersions(plist.CFBundleShortVersionString, gCurrentiTunesVersion) != 1) ) { | |
return true; | |
} | |
my.result.message = system.localizedStringWithFormat('isDowngrade'); | |
my.result.type = 'Fatal'; | |
return false; | |
} | |
function volumeHasTier3() | |
{ | |
var appleLanguages = system.defaults['AppleLanguages']; | |
if(!appleLanguages || (appleLanguages.length == 0)) | |
return false; | |
if (appleLanguages[0] == 'pl') | |
{ | |
system.log("Polish language found"); | |
return false; | |
} | |
return (system.files.fileExistsAtPath("/var/db/.AppleTier3Language")); | |
} | |
function isServer() | |
{ | |
return (system.files.fileExistsAtPath("/System/Library/CoreServices/ServerVersion.plist")); | |
} | |
function ShouldAutoUpdate() | |
{ | |
if ( volumeHasTier3() ) | |
return false; | |
// Fail on G3 | |
if (1 != system.sysctl('hw.vectorunit') ) { | |
return false; | |
} | |
return (volumeNeedsiTunesUpdated()); | |
} | |
function volumeNeedsiTunesUpdated() { | |
var plist = system.files.plistAtPath(my.target.mountpoint + "/System/Library/PrivateFrameworks/iTunesAccess.framework/Versions/A/Resources/version.plist"); | |
if ( !plist ) return true; | |
var version = plist.CFBundleShortVersionString; | |
if ( !version || (-1 == system.compareVersions(version, gPreviousiTunesVersion)) ) return true; | |
// exception for leopard and moved apps | |
// we dont want to patch those | |
var moved = !system.files.fileExistsAtPath(my.target.mountpoint + "/Applications/iTunes.app/Contents/Info.plist"); | |
var isNotSnow = system.compareVersions(my.target.systemVersion.ProductVersion, '10.6') == -1; | |
if ((moved || isNotSnow) && (-1 == system.compareVersions(version, gCurrentiTunesVersion))){ | |
return true; | |
} | |
return false; | |
} | |
function checkBuildVersion(arg_volume, arg_version) | |
{ | |
if (arg_volume == '/' || arg_volume == '') { | |
return (system.compareVersions(system.version.ProductBuildVersion, arg_version)); | |
} else { | |
return (system.compareVersions(my.target.systemVersion.ProductBuildVersion, arg_version)); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment