<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<installer-gui-script minSpecVersion='1'>
    <script>
var AppDefaultPath	= "/Applications/iMovie.app";
var AppMinVersion	= "9.0.0";
var AppMaxVersion	= "9.0.4";
</script>
    <!-- Installer UI-ey stuff -->
    <title>SU_TITLE</title>
    <welcome file="SUDescription.html"/>
    <license auto='false' file="License.rtf" sla="EA0760"/>
    <background file='background.tif' scaling='none' alignment='left'/>
    <options customize="never" rootVolumeOnly="true" hostArchitectures='ppc,i386'/>
    <platforms>
        <client arch="ppc,i386"/>
        <server arch="ppc,i386"/>
    </platforms>
    <!-- Manual Install package layout -->
    <choices-outline>
        <line choice='manual'/>
    </choices-outline>
    <choice id='manual' title='SU_TITLE'>
        <pkg-ref id='manual' auth='Root'>#iMovie9.0.4Update.pkg</pkg-ref>
    </choice>
    <!-- Software Update package layout -->
    <choices-outline ui='SoftwareUpdate'>
        <line choice='su'/>
    </choices-outline>
    <choice id='su' visible='needsiMovieUpdate(AppDefaultPath,AppMinVersion,AppMaxVersion)' suDisabledGroupID='iMovie904Update' title='SU_TITLE' versStr='SU_VERS' description='SU_DESCRIPTION' description-mime-type='text/html' secondaryDescription='SU_SERVERCOMMENT'>
        <pkg-ref id='su' auth='Root'>iMovie9.0.4Update.pkg</pkg-ref>
    </choice>
    <!-- SCRIPT stuff -->
    <installation-check script="InstallationCheck()"/>
    <script>
function InstallationCheck()
{
	// Installation check since we're root volume only. That way, the user gets error
	// right away, not at volume select screen.
	
	return (rootVolumeOSGood() &amp;&amp;
			hasAppStoreReceipt() &amp;&amp;
			canHasUpdateWithErrors(AppDefaultPath,AppMinVersion,AppMaxVersion,"noUpdate","tooNew")
			);
}

function rootVolumeOSGood()
{
	// Error if OS X below 10.6.7
	if (-1 == system.compareVersions(system.version.ProductVersion, '10.6.7'))
	{
		my.result.message = system.localizedStringWithFormat('ERROR_OSSNOWLEO');
		my.result.type = 'Fatal';
		return false;
	}

	// OS X 10.6.7 or newer -- PASS
	return true;
}

function hasAppStoreReceipt()
{
	var receiptPath = "/Applications/iMovie.app/Contents/_MASReceipt/receipt";
	if (system.files.fileExistsAtPath(receiptPath))
	{
		my.result.message = system.localizedStringWithFormat('ERROR_MASAPP');
		my.result.type = 'Fatal';
		return false;
	}

	return true;
}


function canHasUpdateWithErrors(bundlePath, minVersionString, maxVersionString)
{
	var bundleVersion = PathGetShortVersion(bundlePath);
	if (!bundleVersion &amp;&amp; minVersionString &amp;&amp; (minVersionString != 0))
	{
		my.result.message = system.localizedStringWithFormat('ERROR_APP');
		my.result.type = 'Fatal';
		return false;
	}
	
	if (system.compareVersions(bundleVersion,minVersionString) == -1)
	{
		my.result.message = system.localizedStringWithFormat('ERROR_APP');
		my.result.type = 'Fatal';
		return false;
	}
	
	if (system.compareVersions(bundleVersion,maxVersionString) == 1)
	{
		my.result.message = system.localizedStringWithFormat('ERROR_TOONEW');
		my.result.type = 'Fatal';
		return false;
	}
	
	return true;
}

function canHasUpdate(bundlePath, minVersionString, maxVersionString)
{
	return ((system.compareVersions(PathGetShortVersion(bundlePath),minVersionString) >= 0) &amp;&amp;
			(system.compareVersions(PathGetShortVersion(bundlePath),maxVersionString) &lt;= 0));
}

function needsUpdate(bundlePath, minVersionString, maxVersionString)
{
	return ((system.compareVersions(PathGetShortVersion(bundlePath),minVersionString) >= 0) &amp;&amp;
			(system.compareVersions(PathGetShortVersion(bundlePath),maxVersionString) &lt;0));
}

function needsiMovieUpdate()
{
	return (hasAppStoreReceipt() &amp;&amp;
		needsUpdate(AppDefaultPath,AppMinVersion,AppMaxVersion)
	);
}

</script>
    <!-- Common include -->
    <script>
	function PathGetShortVersion(path)
	{
		var bundle = system.files.bundleAtPath(path);
		if (bundle == null)
			return null;
		var shortVers = bundle.CFBundleShortVersionString;
		shortVers = _PadVersionString(shortVers, 3);
		return shortVers;
	}

	function _PadVersionString(version, tupleCount)
	{
		if (version == null)
			version = "0";
		var components = version.split(".");
		if (components.length >tupleCount)
			components = components.slice(0, tupleCount);
		else
			for (;components.length&lt;tupleCount;)
				components.push("0");
		return components.join(".");
	}

	function BundleGetCompositeVersion5(bundle)
	{
		if (bundle == null)
			return null;
		var shortVers = bundle.CFBundleShortVersionString;
		shortVers = _PadVersionString(shortVers, 3);
		var sourceVers = bundle.SourceVersion;
		sourceVers = _PadVersionString(sourceVers, 1);
		var buildVers = bundle.BuildVersion;
		buildVers = _PadVersionString(buildVers, 1);
		var fiveTupleVers = shortVers + "." + sourceVers + "." + buildVers;
		return fiveTupleVers;
	}

	function CheckNameRegistry(path, property, value)
	{
		try
		{
			var obj = system.ioregistry.fromPath(path);
			if (obj == null)
				return false;

			var propObj = obj[property];
			if (propObj == null)
				return false;

			if (typeof(propObj) == "string")	// string
			{
				return (propObj == value);
			}
			else if (typeof(propObj) == "object")	// array contains
			{
				for (var i=0;i&lt;propObj.length;i++)
					if (propObj[i] == value)
						return true;
			}
		}
		catch (e) {}

		return false;
	}
	</script>
    <localization>
        <strings language="pl"><![CDATA["SU_TITLE"		= "iMovie 9.0.4";
"SU_VERS"		= "9.0.4";
"SU_SERVERCOMMENT"	= "Dla systemów klienckich oraz serwerów.";

"SU_DESCRIPTION"='<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"></meta></HEAD>
<BODY><FONT FACE="Lucida Grande">
<P>
To uaktualnienie rozwiązuje ogólne problemy dotyczące zgodności oraz zwiększa stabilność działania programu i rozwiązuje kilka problemów mniejszej wagi, w tym:<UL>
<LI>umożliwia otwieranie projektów importowanych z iMovie dla iOS,
<LI>usuwa błąd dotyczący zachowywania niektórych korekcji audio,
<LI>rozwiązuje problem z wydajnością podczas korzystania z dużych fragmentów klipów wideo przypisanych do kategorii,
<LI>rozwiązuje problem z powolnym uruchamianiem programu przy dużych bibliotekach iPhoto.
</UL></P><P>
Uaktualnienie jest zalecane dla wszystkich użytkowników programu iMovie \'11.
</P>
</FONT></BODY></HTML>
';
]]></strings>
    </localization>

	<pkg-ref id='su' installKBytes='122723' version='9.0.4.0.1.1203730862'/>
</installer-gui-script>