<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<installer-gui-script minSpecVersion='1'>
    <title>SU_TITLE</title>
    <options hostArchitectures='ppc,i386'/>
    <options customize="never" rootVolumeOnly="true"/>
    <platforms>
        <client arch="ppc,intel"/>
        <server arch="ppc,intel"/>
    </platforms>
    <welcome file="Welcome.rtf"/>
    <readme file="ReadMe.rtf"/>
    <background file="background.png" scaling="proportional" alignment="bottomleft"/>
    <choices-outline>
        <line choice='manual'/>
    </choices-outline>
    <choice id='manual'>
        <pkg-ref id='manual' auth='Root' version='SU_VERS'>.</pkg-ref>
    </choice>
    <choices-outline ui='SoftwareUpdate'>
        <line choice='su'/>
    </choices-outline>
    <!-- This choice doesn't install anything, it just shows up if an update is needed. -->
    <choice id='su' suDisabledGroupID='iTunesX' title='SU_TITLE' versStr='SU_VERS' description='SU_DESCRIPTION' description-mime-type='text/html' visible='ShouldAutoUpdate()'/>
    <!-- Software Update "tag along" package layout -->
    <choices-outline ui='invisible'>
        <line choice='amds'/>
        <line choice='CoreFP'/>
        <line choice='CoreFP1'/>
        <line choice='iTunes'/>
        <line choice='iTunesAccess'/>
        <line choice='iTunesLibrary'/>
    </choices-outline>
    <!-- Lion App Closing -->
    <pkg-ref id='amds'>
        <must-close>
            <app id="com.apple.dt.Xcode"/>
            <app id="com.apple.AppleConfigurationUtility"/>
            <app id="com.apple.configurator"/>
            <app id="com.apple.PurpleRestore"/>
            <app id="com.apple.iTunes"/>
        </must-close>
    </pkg-ref>
    <pkg-ref id='iTunes'>
        <must-close>
            <app id="com.apple.iTunes"/>
        </must-close>
    </pkg-ref>
    <choice id="amds" selected="ShouldAutoUpdate() &amp;&amp; installMobilitySupport() &amp;&amp; (typeof(choices.su) != &quot;undefined&quot;)">
        <pkg-ref id='amds' auth='Root'>AppleMobileDeviceSupport.pkg</pkg-ref>
    </choice>
    <choice id="CoreFP" selected="ShouldAutoUpdate() &amp;&amp; (typeof(choices.su) != &quot;undefined&quot;)">
        <pkg-ref id='CoreFP' auth='Root'>CoreFP.pkg</pkg-ref>
    </choice>
    <choice id="CoreFP1" selected="ShouldAutoUpdate() &amp;&amp; installCoreFP1() &amp;&amp; (typeof(choices.su) != &quot;undefined&quot;)">
        <pkg-ref id='CoreFP1' auth='Root'>CoreFP1.pkg</pkg-ref>
    </choice>
    <choice id="iTunes" selected="ShouldAutoUpdate() &amp;&amp; (typeof(choices.su) != &quot;undefined&quot;)">
        <pkg-ref id='iTunes' auth='Root'>iTunesX.pkg</pkg-ref>
    </choice>
    <choice id="iTunesAccess" selected="ShouldAutoUpdate() &amp;&amp; (typeof(choices.su) != &quot;undefined&quot;)">
        <pkg-ref id='iTunesAccess' auth='Root'>iTunesAccess.pkg</pkg-ref>
    </choice>
    <choice id="iTunesLibrary" selected="ShouldAutoUpdate() &amp;&amp; installiTunesLibrary() &amp;&amp; (typeof(choices.su) != &quot;undefined&quot;)">
        <pkg-ref id='iTunesLibrary' auth='Root'>iTunesLibrary.pkg</pkg-ref>
    </choice>
    <installation-check script='InstallationCheck()'/>
    <volume-check script='VolumeCheck()'/>
    <script>

	var gCurrentiTunesVersion = '10.6.3';
	var gPreviousiTunesVersion = '10.6.3';  // There is no patch for this release.  Usually this would be one less than gCurrentiTunesVersion
	function installMobilitySupport()
    {	
		if (system.files.fileExistsAtPath('/tmp/com.apple.mpkg.iTunes.noAMDS')){
		    return false;
		}
		
		return true;
    }
    
  function installiTunesLibrary()
    {	
		  return (system.compareVersions(system.version.ProductVersion, "10.6") >= 0);
    }

	function installCoreFP1()
    {
        // do not downgrade
        var plist = system.files.plistAtPath("/System/Library/PrivateFrameworks/CoreFP1.framework/Resources/version.plist");
              
        //if there is no plist then we need CoreFP1
        if (!plist) 
            return true;
        
        //CoreFP1 version in 10.6.1 is 1.14.37
        var version = plist.CFBundleShortVersionString;//this will explode if there is no plist
        if ( 1 > system.compareVersions(version, "1.14.37"))
           return true;
        
        return false;
    }

    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, '10.5') == -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, '10.5') == -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 &amp;&amp; (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 GreaterThanTiger()
    {
    	return (system.compareVersions(system.version.ProductVersion, "10.5") >= 0);
    }
    
    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) &amp;&amp; (-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>
    <localization>
        <strings language="pl"><![CDATA["SU_TITLE" = "iTunes";
"SU_SERVERCOMMENT" = "Dla komputerów klienckich i serwerów";
"SU_VERS" = "10.6.3";

"SU_DESCRIPTION"='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="1138.32">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 15.0px Helvetica}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    span.s1 {text-decoration: underline ; color: #0e6ce8}
  </style>
</head>
<body>
<p class="p1"><b>Co nowego w iTunes 10.6.3</b></p>
<p class="p2"><br></p>
<p class="p3">Program iTunes 10.6.3 dodaje obsługę systemu OS X Mountain Lion oraz rozwiązuje szereg ważnych problemów:</p>
<p class="p2"><br></p>
<p class="p3">• usuwa problem, w wyniku którego iTunes mógł przestać odpowiadać w czasie synchronizowania z iPadem (1. generacji), który zawiera podręcznik iBooks;</p>
<p class="p3">• rozwiązuje problem, który powodował wyświetlanie zdjęć synchronizowanych z urządzeniem w nieoczekiwanym porządku;</p>
<p class="p3">• usuwa błąd, który powodował nieoczekiwane usuwanie przez iTunes list utworów utworzonych na urządzeniu;</p>
<p class="p3">• usuwa problem, który mógł powodować nieoczekiwane usuwanie przez iTunes programów z urządzenia;</p>
<p class="p3">• poprawia ogólną wydajność i stabilność.</p>
<p class="p2"><br></p>
<p class="p3">Informacje na temat zawartości tego uaktualnienia związanej z zabezpieczeniami można znaleźć pod adresem: <a href="http://support.apple.com/kb/HT1222?viewlocale=pl_PL"><span class="s1">support.apple.com/kb/HT1222?viewlocale=pl_PL</span></a></p>
</body>
</html>
';
]]></strings>
    </localization>

	<pkg-ref id='amds' installKBytes='12248' version='4.0.1.1188253749'/>
	<pkg-ref id='CoreFP' installKBytes='14261' version='2.0.1.1188253749'/>
	<pkg-ref id='CoreFP1' installKBytes='55435' version='1.12.1.1188253749'/>
	<pkg-ref id='iTunes' installKBytes='271974' version='10.6.3.0.1.1188253749'/>
	<pkg-ref id='iTunesAccess' installKBytes='2563' version='10.6.3.0.1.1188253749'/>
	<pkg-ref id='iTunesLibrary' installKBytes='2467' version='10.6.3.0.1.1188253749'/>
</installer-gui-script>