<?xml version="1.0"?>
<installer-gui-script minSpecVersion='1.0040'>
    <platforms>
        <client arch="i386,ppc"/>
    </platforms>
    <title>TITLE_DIST</title>
    <license file='License.rtf'/>
    <welcome file='Welcome.rtf'/>
    <background file='background.tiff' alignment='left' scaling='proportional'/>
    <options customize='allow'/>
    <options allow-external-scripts='yes'/>
    <options rootVolumeOnly='true'/>
    <options mpkg='com.apple.mpkg.Aperture'/>
    <installation-check script='installationCheck()'/>
    <choices-outline>
        <line choice="Aperture"/>
        <line choice="ApertureSampleProjects"/>
        <!-- invisible choices for shared components -->
        <line choice="PluginManager"/>
        <line choice="ProRuntime"/>
        <line choice="ProAppRuntime"/>
        <line choice='iLMB'/>
        <line choice='GAS'/>
        <line choice='ImageKit'/>
        <line choice='QuartzComposerAppSupport'/>
        <line choice='QCQTComponentAppSupport'/>
        <line choice='ImageIO'/>
        <line choice='RAWCamera'/>
        <!-- -->
    </choices-outline>
    <choice id="Aperture" title="TITLE_APERTURE" description="DESCRIPTION_APERTURE" start_enabled='my.choice.packageUpgradeAction == "installed"' start_selected='isNotDowngrade()'>
        <pkg-ref auth='Root' id='com.apple.pkg.Aperture' installKBytes="230103" version="2.0.0.1270000.748">file:../Packages/Aperture.pkg</pkg-ref>
    </choice>
    <choice id="ApertureSampleProjects" start_selected="my.choice.enabled" title="TITLE_APERTURESAMPLEPROJECTS" description='DESCRIPTION_APERTURESAMPLEPROJECTS'>
        <pkg-ref auth='Root' id='com.apple.pkg.ApertureSampleProjects' installKBytes="2920308" version="2.0.0.1240000.741">file:../Packages/ApertureSampleProjects.pkg</pkg-ref>
    </choice>
    <!--	
		invisible choices for shared components.  these software might be installed by way of another pro app, 
		so grouping them separately (and making them install if the dependent proapp is installed) will allow
		them to install the pro app, while making sure downgrades of the shared pieces are prevented.
-->
    <choice id="PluginManager" title="PluginManager" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected)">
        <pkg-ref auth='Root' id='com.apple.pkg.PluginManager' installKBytes="2633" version="1.7.0.830000.1588">file:../Packages/PluginManager.pkg</pkg-ref>
    </choice>
    <!--	-->
    <choice id="ProRuntime" title="ProRuntime" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected)">
        <pkg-ref auth='Root' id='com.apple.pkg.ProRuntime' installKBytes="65096" version="4.5.0.1000000.1420">file:../Packages/ProRuntime.pkg</pkg-ref>
    </choice>
    <choice id="ProAppRuntime" title="ProAppRuntime" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected) &amp;&amp; isTiger()">
        <pkg-ref auth='Root' id='com.apple.pkg.ProAppRuntime' installKBytes="52841" version="4.5.0.1000000.1415">file:../Packages/ProAppRuntime.pkg</pkg-ref>
    </choice>
    <!--	-->
    <choice id="iLMB" title="iLifeMediaBrowser" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected)">
        <pkg-ref id='com.apple.pkg.iLifeMediaBrowser' auth='Root' installKBytes="4196" version="2.0.0.270000.96">file:../Packages/iLifeSupport.mpkg/Contents/Installers/iLifeMediaBrowser.pkg</pkg-ref>
    </choice>
    <choice id="GAS" title="GraphicsAppSupport" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected) &amp;&amp; isTiger()">
        <pkg-ref id='com.apple.pkg.GraphicsAppSupport' auth='Root' installKBytes="43" version="1.0.0.270000.96">file:../Packages/iLifeSupport.mpkg/Contents/Installers/GraphicsAppSupport.pkg</pkg-ref>
    </choice>
    <choice id="ImageKit" title="ImageKit" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected) &amp;&amp; isTiger()">
        <pkg-ref id='com.apple.pkg.ImageKit_Tiger' auth='Root' installKBytes="1875" version="1.0.0.270000.96">file:../Packages/iLifeSupport.mpkg/Contents/Installers/ImageKit_Tiger.pkg</pkg-ref>
    </choice>
    <choice id="QuartzComposerAppSupport" title="QuartzComposerAppSupport" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected) &amp;&amp; isTiger()">
        <pkg-ref id='com.apple.pkg.QuartzComposerAppSupport' auth='Root' installKBytes="5291" version="1.0.0.270000.96">file:../Packages/iLifeSupport.mpkg/Contents/Installers/QuartzComposerAppSupport.pkg</pkg-ref>
    </choice>
    <choice id="QCQTComponentAppSupport" title="QuartzComposerQuickTimeComponentAppSupport" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected) &amp;&amp; isTiger()">
        <pkg-ref id='com.apple.pkg.QCQTComponentAppSupport' auth='Root' installKBytes="119" version="1.0.0.270000.96">file:../Packages/iLifeSupport.mpkg/Contents/Installers/QCQTComponentAppSupport.pkg</pkg-ref>
    </choice>
    <choice id="ImageIO" title="ImageIO" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected) &amp;&amp; isTiger()">
        <pkg-ref id='com.apple.pkg.ImageIO' auth='Root' installKBytes="4699" version="1.0.0.30000.96">file:../Packages/iLifeSupport.mpkg/Contents/Installers/ImageIO.pkg</pkg-ref>
    </choice>
    <choice id="RAWCamera" title="TITLE_RAWCAMERA" start_visible="false" start_enabled='isNotDowngrade()' selected="my.choice.enabled &amp;&amp; (choices.Aperture.selected)">
        <pkg-ref id='com.apple.pkg.RAWCamera' auth='Root' installKBytes="4549" version="1.0.0.30000.96">file:../Packages/iLifeSupport.mpkg/Contents/Installers/RAWCamera.pkg</pkg-ref>
    </choice>
    <script>

function installationCheck() 
{
	// PPC Only checks here


	// All systems require these checks
	if (!checkRAMRequirement(1000)) {
		my.result.message = system.localizedString('ERROR_INCOMPATRAM');
		my.result.type = 'Fatal';
		return false;
	}
	
	if( isTiger() )
	{
		// Must have 10.4.11 or later.
		if ( !checkSystemVersionTiger() )
		{
			my.result.message = system.localizedString('ERROR_OSTIGER');
			my.result.type = 'Fatal';
			return false;
		}
	}
	
	if( isLeopard() )
	{
		// Must have 10.5.2 or later.
		if ( !checkSystemVersionLeopard() )
		{
			my.result.message = system.localizedString('ERROR_OSLEOPARD');
			my.result.type = 'Fatal';
			return false;
		}
	}
	
	return true;
}
		
function checkCPUFrequency(checkFreq) {
	var cpuFreq = system.sysctl('hw.cpufrequency');
	
	return (cpuFreq > (checkFreq - 1));
}

function checkRAMRequirement(RAM) {
	var requiredRAM = (RAM * 1024 * 1024);
	var actualRAM = system.sysctl('hw.memsize');
	
	return (actualRAM > (requiredRAM - 1));
}

function isIntel()
{
	return (system.sysctl('hw.byteorder') == '1234');
}

function isTiger()
{
	return (system.compareVersions(system.version.ProductVersion,"10.4.0") >= 0) &amp;&amp; (system.compareVersions(system.version.ProductVersion,"10.5.0") &lt; 0);
}

function isLeopard()
{
	return (system.compareVersions(system.version.ProductVersion,"10.5.0") >= 0) &amp;&amp; (system.compareVersions(system.version.ProductVersion,"10.6.0") &lt; 0);
}

function checkSystemVersionTiger()
{
	return (system.compareVersions(system.version.ProductVersion,"10.4.11") >= 0) &amp;&amp; (system.compareVersions(system.version.ProductVersion,"10.5.0") &lt; 0);
}

function checkSystemVersionLeopard()
{
	return (system.compareVersions(system.version.ProductVersion,"10.5.2") >= 0);
}

function isNotDowngrade() 
{
	var action = my.choice.packageUpgradeAction;
	
	return ((action != 'downgrade') &amp;&amp; (action != 'mixed'));
}

function isTiger()
{
	// return true if root volume is 10.4 or newer, not 10.5 or newer
	if ( system.compareVersions(system.version.ProductVersion, "10.4") >= 0) 
	{
		if ( system.compareVersions(system.version.ProductVersion, "10.5") &lt; 0) 
		{
			return true;
		}
	}
	return false;
}
</script>
    <pkg-ref id='com.apple.mpkg.Aperture' auth='Root'>.</pkg-ref>
</installer-gui-script>