<?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 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) {
	var models = ['MacBookAir3,1','MacBookAir3,2',];
	var model = system.sysctl('hw.model');
	if (models.indexOf(model) == -1) {
		my.result.message = system.localizedString('ERROR_1');
		my.result.type = 'Fatal';
		return false;
	}
	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.5') &lt; 0) {
		my.result.message = system.localizedStringWithFormat('ERROR_2', '10.6.5');
		my.result.type = 'Fatal';
		return false;
	}
	if (!hasOS || system.compareVersions(my.target.systemVersion.ProductVersion, '10.6.6') > 0) {
		my.result.message = system.localizedStringWithFormat('ERROR_3', '10.6.6');
		my.result.type = 'Fatal';
		return false;
	}
	if (compareBuildVersions(my.target.systemVersion.ProductBuildVersion, '10H707') &lt; 0) {
		my.result.message = system.localizedString('ERROR_4');
		my.result.type = 'Fatal';
		return false;
	}
	my.result.message = system.localizedString('ERROR_4');
	if (!FileCheck0(my.target.mountpoint) || !FileCheck1(my.target.mountpoint)) {
		my.result.type = 'Fatal';
		return false;
	}
	return true;
}
function FileCheck0(prefix) {
	if (system.files.fileExistsAtPath(prefix + '/System/Library/LaunchDaemons/com.apple.batteryd.plist') == 1) {
		return true;
	}
	return false;
}
function FileCheck1(prefix) {
	if (system.files.fileExistsAtPath(prefix + '/usr/local/libexec/batteryd') == 0) {
		return true;
	}
	return false;
}
</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="MacBookAirSoftwareUpdate2.0" visible="FileCheck0('/') &amp;&amp; FileCheck1('/')">
        <pkg-ref id="package1" auth="Root" packageIdentifier="com.apple.pkg.update.macbookair3_1_3_2">MacBookAirLate2010SoftwareUpdate2.0.pkg</pkg-ref>
    </choice>
    <localization>
        <strings language="pl"><![CDATA["SU_TITLE" = "Uaktualnienie oprogramowania MacBooka Air (z końca 2010 roku)";
"SU_VERS" = "2.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 rozwiązuje problem uniemożliwiający usypianie niektórych MacBooków Air (z końca 2010 roku).</p>
</body>
</html>';
]]></strings>
    </localization>

	<pkg-ref id='package1' installKBytes='66' version='2.0.0.0.1.1249367152'/>
</installer-gui-script>