<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion="1">
    <options hostArchitectures="i386" customize="never"/>
    <title>SU_TITLE</title>
    <script>
</script>
    <volume-check script="VolumeCheck()"/>
    <installation-check script="InstallationCheck()"/>
    <script>
function isVirtualMachine(){
	
	var cpuFeatures = system.sysctl( 'machdep.cpu.features' );
			cpuFeatures=cpuFeatures.split(" ");
			for( var i = 0; i &lt; cpuFeatures.length; i++ ){
			 	if( cpuFeatures[i] == "VMM" ){
						return true;
			  	}	
			}
			return false;			
			
}

function isSupportedPlatform(){

    if( isVirtualMachine() ){
        return true;
    }

    var platformSupportValues=["Mac-031B6874CF7F642A","Mac-F2268DC8","Mac-50619A408DB004DA","Mac-F2218EA9","Mac-F42D86A9","Mac-F22C8AC8","Mac-F22586C8","Mac-AFD8A9D944EA4843","Mac-F227BEC8","Mac-F226BEC8","Mac-7DF2A3B5E5D671ED","Mac-35C1E88140C3E6CF","Mac-942459F5819B171B","Mac-77EB7D7DAF985301","Mac-942B59F58194171B","Mac-2E6FAB96566FE58C","Mac-7BA5B2794B2CDB12","Mac-031AEE4D24BFF0B1","Mac-00BE6ED71E35EB86","Mac-4B7AC7E43945597E","Mac-F22C89C8","Mac-F221DCC8","Mac-F42388C8","Mac-F223BEC8","Mac-F4238CC8","Mac-F222BEC8","Mac-4BC72D62AD45599E","Mac-F2208EC8","Mac-66F35F19FE2A0D05","Mac-F4238BC8","Mac-F221BEC8","Mac-C08A6BB70A942AC2","Mac-8ED6AF5B48C039E1","Mac-F2238AC8","Mac-FC02E91DDD3FA6A4","Mac-6F01561E16C75D06","Mac-F22589C8","Mac-F22587A1","Mac-F22788AA","Mac-F42C86C8","Mac-942C5DF58193131B","Mac-F2238BAE","Mac-F22C86C8","Mac-F2268CC8","Mac-F2218FC8","Mac-742912EFDBEE19B3","Mac-27ADBB7B4CEE8E61","Mac-F65AE981FFA204ED","Mac-F42D89C8","Mac-F22587C8","Mac-F42D89A9","Mac-F2268AC8","Mac-F42C89C8","Mac-942452F5819B1C1B","Mac-F2218FA9","Mac-F42D88C8","Mac-94245B3640C91C81","Mac-F42D86C8","Mac-F2268EC8","Mac-F2268DAE","Mac-7DF21CB3ED6977E5","Mac-F42C88C8","Mac-94245A3940C91C80","Mac-F42386C8","Mac-C3EC7CD22292981F","Mac-942B5BF58194151B","Mac-F2218EC8"];
    var boardID = system.ioregistry.fromPath('IOService:/')['board-id'];

    if( !boardID || platformSupportValues.length == 0 ) {
        return false;
    }
    for( var i = 0; i &lt; platformSupportValues.length; i++ ){
        if( boardID == platformSupportValues[i] ){
                return true;
        }
    }

    return false;
}
</script>
    <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.6') &lt; 0 || system.compareVersions(system.version.ProductVersion, '10.7') >= 0) {
		my.result.message = system.localizedStringWithFormat('ERROR_0', '10.6');
		my.result.type = 'Fatal';
		return false;
	}
	return true;
}
function VolumeCheck(prefix) {
	if (system.env.OS_INSTALL == 1) return true;
	var hasOS = system.files.fileExistsAtPath(my.target.mountpoint + "/System/Library/CoreServices/SystemVersion.plist");
	if (!hasOS || system.compareVersions(my.target.systemVersion.ProductVersion, '10.6') &lt; 0 || system.compareVersions(my.target.systemVersion.ProductVersion, '10.7') >= 0) {
		my.result.message = system.localizedStringWithFormat('ERROR_0', '10.6');
		my.result.type = 'Fatal';
		return false;
	}
	if (!hasOS || system.compareVersions(my.target.systemVersion.ProductVersion, '10.6.8') &lt; 0) {
		my.result.message = system.localizedStringWithFormat('ERROR_2', '10.6.8');
		my.result.type = 'Fatal';
		return false;
	}
	if (compareBuildVersions(my.target.systemVersion.ProductBuildVersion, '10K549') &lt; 0) {
		my.result.message = system.localizedString('ERROR_3');
		my.result.type = 'Fatal';
		return false;
	}
	return true;
}
function Not0(prefix) {
	if (!(Script1(prefix))) {
		return true;
	}
	return false;
}
function Script1(prefix) {
	if (!my.target.receiptForIdentifier('com.apple.pkg.MacAppStoreUpdate.1')) {
		return false;
	}
	return true;
}
function Script2(prefix) {
	if (!isSupportedPlatform()) {
		return false;
	}
	return true;
}
</script>
    <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" title="SU_TITLE" versStr="SU_VERS" description="SU_DESCRIPTION" description-mime-type="text/html" secondaryDescription="SU_SERVERCOMMENT" suDisabledGroupID="Mac App Store Update for OS X Snow Leopard" visible="Not0('/')">
        <pkg-ref id="MacAppStoreUpdateNB" auth="Root" packageIdentifier="com.apple.pkg.MacAppStoreUpdateNB.1" active="Script2('/')">MacAppStoreUpdateNB.pkg</pkg-ref>
        <pkg-ref id="MacAppStoreUpdate" auth="Root" packageIdentifier="com.apple.pkg.MacAppStoreUpdate.1">MacAppStoreUpdate.pkg</pkg-ref>
    </choice>
    <localization>
        <strings language="pl"><![CDATA["SU_TITLE" = "Uaktualnienie programu Mac App Store dla systemu OS X Snow Leopard";
"SU_VERS" = "1.0";
"SU_SERVERCOMMENT" = "Dla komputerów klienckich i serwerów";
"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>
        <style type="text/css">
            body {font: 11.0px Lucida Grande;}
            p {margin: 0.0px 0.0px 0.0px 0.0px;}
        </style>
    </head>
    <body>
        <p>To uaktualnienie zapewnia przyszłą zgodność programu Mac App Store dołączonego do systemu OS X Snow Leopard i jest zalecane dla wszystkich użytkowników tego systemu.</p>
        <p><br/></p>
        <p>Szczegółowe informacje na temat tego uaktualnienia można znaleźć pod adresem: <a href="https://support.apple.com/kb/HT205702?viewlocale=pl_PL">https://support.apple.com/kb/HT205702?viewlocale=pl_PL</a>.</p>
    </body>
</html>
';
]]></strings>
    </localization>

	<pkg-ref id='MacAppStoreUpdate' installKBytes='227' version='1.0.0.0.1.1249367152'/>
	<pkg-ref id='MacAppStoreUpdateNB' installKBytes='9382' version='1.0.0.0.1.1249367152'/>
</installer-gui-script>