<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
    <options hostArchitectures="i386" customize="never"/>
    <title>SU_TITLE</title>
    <script/>
    <installation-check script="InstallationCheck()"/>
    <tags>
        <tag>MacBuddyInstallableiTunesUpdate</tag>
    </tags>
    <platforms>
        <client arch="i386"/>
        <server arch="i386"/>
    </platforms>
    <choices-outline ui="SoftwareUpdate">
        <line choice="su"/>
    </choices-outline>
    <choices-outline>
        <line choice="su"/>
    </choices-outline>
    <choice id="su" description-mime-type="text/html" secondaryDescription="SU_SERVERCOMMENT" suDisabledGroupID="iTunesX" start_selected="true" versStr="SU_VERS" description="SU_DESCRIPTION" title="SU_TITLE" visible="sourceVersionOlder(my.target.mountpoint) &amp;&amp; dontUpdate1263(my.target.mountpoint)">
        <pkg-ref id="iTunesX" auth="Root">
            <must-close>
                <app id="com.apple.iTunes"/>
                <app id="com.apple.dt.Xcode"/>
            </must-close>
        </pkg-ref>
        <pkg-ref id="iTunesX" auth="Root" packageIdentifier="com.apple.pkg.iTunesX">iTunesX.pkg</pkg-ref>
        <pkg-ref id="iTunesAccess" auth="Root" packageIdentifier="com.apple.pkg.iTunesAccess">iTunesAccess.pkg</pkg-ref>
        <pkg-ref id="CoreFP" auth="Root" packageIdentifier="com.apple.pkg.CoreFP">CoreFP.pkg</pkg-ref>
        <pkg-ref id="CoreADI" auth="Root" packageIdentifier="com.apple.pkg.CoreADI">CoreADI.pkg</pkg-ref>
        <pkg-ref id="MobileDevice" auth="Root">
            <must-close>
                <app id="com.apple.dt.Xcode"/>
                <app id="com.apple.PurpleRestore"/>
                <app id="com.apple.AppleConfigurationUtility"/>
                <app id="com.apple.configurator"/>
                <app id="com.apple.iTunes"/>
                <app id="com.apple.iPhoto"/>
                <app id="com.apple.Aperture"/>
            </must-close>
        </pkg-ref>
        <pkg-ref id="MobileDevice" auth="Root" packageIdentifier="com.apple.pkg.MobileDevice" active="installMobileDevice(my.target.mountpoint)">MobileDevice.pkg</pkg-ref>
    </choice>
    <script>
function compareBuildVersions(lhs, rhs) {
	var lhsMatch = lhs.match(/([0-9]+)([A-Z])([0-9]+)([a-z])?/);
	var rhsMatch = rhs.match(/([0-9]+)([A-Z])([0-9]+)([a-z])?/);
	return system.compareVersions(lhsMatch.slice(1).join(","), rhsMatch.slice(1).join(","));
}
function InstallationCheck(prefix) {
	if (system.compareVersions(system.version.ProductVersion, '10.11.4') &lt; 0) {
		my.result.message = system.localizedStringWithFormat('ERROR_B85E600482', '10.11.4');
		my.result.type = 'Fatal';
		return false;
	}
	if (system.compareVersions(system.version.ProductVersion, '10.13.99') &gt; 0) {
		my.result.message = system.localizedStringWithFormat('ERROR_25CBFE41C7', '10.13.99');
		my.result.type = 'Fatal';
		return false;
	}
	if (compareBuildVersions(system.version.ProductBuildVersion, '14F2511') &lt; 0) {
		my.result.message = system.localizedString('ERROR_3491501876');
		my.result.type = 'Fatal';
		return false;
	}
	my.result.message = system.localizedString('ERROR_3491501876');
	if (!dontDowngrade("/")) {
		my.result.type = 'Fatal';
		return false;
	}
	return true;
}
function dontDowngrade(prefix) {
	if (iTunesAppOlderOrEqual(prefix) &amp;&amp; sourceVersionOlderOrEqual(prefix)) {
		return true;
	}
	if (typeof(my.result) != 'undefined') my.result.message = system.localizedString('ERROR_B56CB90286');
	return false;
}
function iTunesAppOlderOrEqual(prefix) {
	var bundle = system.files.bundleAtPath(prefix + '/Applications/iTunes.app');
	if (!bundle) {
		return true;
	}
	var bundleKeyValue = bundle['CFBundleShortVersionString'];
	if (!bundleKeyValue) {
		return true;
	}
	if (system.compareVersions(bundleKeyValue, '12.8.2.0') &gt; 0) {
		return false;
	}
	return true;
}
function sourceVersionOlderOrEqual(prefix) {
	var bundle = system.files.bundleAtPath(prefix + '/Applications/iTunes.app');
	if (!bundle) {
		return true;
	}
	var bundleKeyValue = bundle['SourceVersion'];
	if (!bundleKeyValue) {
		return true;
	}
	if (system.compareVersions(bundleKeyValue, '1200012008002003') &gt; 0) {
		return false;
	}
	return true;
}
function sourceVersionOlder(prefix) {
	var bundle = system.files.bundleAtPath(prefix + '/Applications/iTunes.app');
	if (!bundle) {
		return true;
	}
	var bundleKeyValue = bundle['SourceVersion'];
	if (!bundleKeyValue) {
		return true;
	}
	if (system.compareVersions(bundleKeyValue, '1200012008002003') &gt;= 0) {
		return false;
	}
	return true;
}
function dontUpdate1263(prefix) {
	if (!(TwelveSixThreePlusInstalled(prefix))) {
		return true;
	}
	return false;
}
function TwelveSixThreePlusInstalled(prefix) {
	if (isLessEqualTwelveSixTen(prefix) &amp;&amp; isGreaterEqualTwelveSixThree(prefix)) {
		return true;
	}
	return false;
}
function isLessEqualTwelveSixTen(prefix) {
	var bundle = system.files.bundleAtPath(prefix + '/Applications/iTunes.app');
	if (!bundle) {
		return false;
	}
	var bundleKeyValue = bundle['CFBundleShortVersionString'];
	if (!bundleKeyValue) {
		return false;
	}
	if (system.compareVersions(bundleKeyValue, '12.6.10.0') &gt; 0) {
		return false;
	}
	return true;
}
function isGreaterEqualTwelveSixThree(prefix) {
	var bundle = system.files.bundleAtPath(prefix + '/Applications/iTunes.app');
	if (!bundle) {
		return false;
	}
	var bundleKeyValue = bundle['CFBundleShortVersionString'];
	if (!bundleKeyValue) {
		return false;
	}
	if (system.compareVersions(bundleKeyValue, '12.6.3.0') &lt; 0) {
		return false;
	}
	return true;
}
function installMobileDevice(prefix) {
	if (system.files.fileExistsAtPath(prefix + '/tmp/com.apple.mpkg.iTunes.noAMDS') == 0) {
		return true;
	}
	return false;
}
</script>
    <localization>
        <strings language="pl">"SU_TITLE" = "iTunes";
"SU_VERS" = "12.8.2";
"SU_SERVERCOMMENT" = "Dla komputerów klienckich i serwerów";
"SU_DESCRIPTION" = '&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
  &lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;meta name="Generator" content="Cocoa HTML Writer"&gt;
  &lt;meta name="CocoaVersion" content="1671.2"&gt;
  &lt;style type="text/css"&gt;
    p.p1 {margin: 0.0px 0.0px 10.0px 0.0px; font: 14.0px \'Helvetica Neue\'}
    span.s1 {font-kerning: none}
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;To uaktualnienie rozwiązuje problem, który mógł uniemożliwiać iTunes odtwarzanie multimediów na głośnikach AirPlay innych firm. Zawiera także drobne udoskonalenia aplikacji oraz poprawki podnoszące jej wydajność.&lt;/span&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
';
</strings>
    </localization>
    <pkg-ref id="iTunesAccess" installKBytes="989" version="12.8.2.0.1.1547790655"/>
    <pkg-ref id="CoreFP" installKBytes="51541" version="2.13.22.0.1.1547790655"/>
    <pkg-ref id="iTunesX" installKBytes="254095" version="12.8.2.0.1.1547790655"/>
    <pkg-ref id="CoreADI" installKBytes="5089" version="2.9.2.0.1.1547790655"/>
    <pkg-ref id="MobileDevice" installKBytes="112642" version="4.0.0.0.1.1547152269"/>
</installer-gui-script>