<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion='1'>
    <title>SU_TITLE</title>
    <platforms>
        <client arch="i386"/>
        <server arch="i386"/>
    </platforms>
    <options hostArchitectures='i386' customize='never' rootVolumeOnly='true'/>
    <choices-outline>
        <line choice='manual'/>
    </choices-outline>
    <choices-outline ui='SoftwareUpdate'>
        <line choice='su'/>
    </choices-outline>
    <choices-outline ui='invisible'>
        <line choice='invis'/>
    </choices-outline>
    <choice id='manual' title='SU_TITLE' versStr='SU_VERS'>
        <pkg-ref auth='Root' id='manual'>#HardDriveUpdate.pkg</pkg-ref>
    </choice>
    <choice id='su' suDisabledGroupID='HardDriveUpdate'/>
    <choice id='su' title='SU_TITLE' versStr='SU_VERS'/>
    <choice id='su' description='SU_DESCRIPTION' description-mime-type='text/html'/>
    <choice id='su' start_selected='false'/>
    <choice id='invis' selected='typeof(choices.su) != "undefined"'>
        <pkg-ref auth='Root' id='invis'>HardDriveUpdate.pkg</pkg-ref>
    </choice>
    <installation-check script='InstallationCheck()'/>
    <volume-check script='VolumeCheck()'/>
    <script>
	
	function InstallationCheck() {
		if ( !isValidMachine() || !validHW() ) {
            my.result.message = system.localizedStringWithFormat('ERR_HW');
            my.result.type = 'Fatal';
            return false;	       
        }
        
        return true;	   
	}
	
	function VolumeCheck() 	{
        if (system.env.OS_INSTALL == 1) {
            return true;
        }

        if ( !hasOS() || !hasOSVer() ) {
            my.result.message = system.localizedStringWithFormat('ERR_OS', '10.5.7');
            my.result.type = 'Fatal';
            return false;	       
        }
                
        return true;
	}

    function hasOS() {
        return (system.files.fileExistsAtPath(my.target.mountpoint + "/System/Library/CoreServices/SystemVersion.plist"));
    }

	function hasOSVer() {
        if (-1 == system.compareVersions(my.target.systemVersion.ProductVersion, '10.5.7')) {
            return false;
        }
        return true;
    }
	
    function isValidMachine()
    {
        var property = system.sysctl("hw.model");
        if (property &amp;&amp; (property == "MacBookPro5,3") || 
								(property == "MacBookPro5,4") ||
								(property == "MacBookPro5,2") ) {
            return true;
        }
        
        return false;
    }

    function validHW() {
		var reg;
		try {
			reg = system.ioregistry.matchingName('IOAHCIDevice');
			for( var i = 0 ; i &lt; reg.length ; i++ ) {
				var childrenArray = system.ioregistry.childrenOf(reg[i]);
				for( var j = 0 ; j &lt; childrenArray.length ; j++ ) {
					var model = childrenArray[j]['Model'];
					var revision = childrenArray[j]['Revision'];
					
					if( null != model &amp;&amp; null != revision ) {
						if( model.match(/ST9320423ASG/) &amp;&amp; revision.match(/0006APM2/)) {
							return true;
						}
						
						if( model.match(/ST9500420ASG/) &amp;&amp; revision.match(/0006APM2/)) {
							return true;
						}

					}
				}
			}
		} catch(err) { return false; }
             
        return false;
    }
    
	</script>
    <readme file="SUDescription.html"/>
    <conclusion file="Conclusion.rtf"/>
    <license file="License.rtf" sla="EA0325"/>
    <localization>
        <strings language="pl"><![CDATA["SU_TITLE" = "Uaktualnienie oprogramowania sprzętowego dysku twardego";
"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">
	p {margin-left: 0.0px; margin-top: 0.0px; font: 11.0px "Lucida Grande";}
  </style>
</head>
<body>
<p>Uaktualnienie oprogramowania sprzętowego dysku twardego 2.0 MacBooka Pro minimalizuje sporadyczny hałas, jaki emitują dyski twarde 7200 obr./min w MacBookach Pro wyprodukowanych w czerwcu 2009 roku.</p>
<p>Aby uaktualnić oprogramowanie sprzętowe, postępuj zgodnie z instrukcjami programu uaktualniającego (/Programy/Narzędzia/Uaktualnienie dysku twardego.app). Program uaktualniający zostanie uruchomiony automatycznie po zamknięciu Instalatora.</p>
</body>
</html>
';
]]></strings>
    </localization>

	<pkg-ref id='invis' installKBytes='15894' version='2.0.1.1250540751'/>
</installer-gui-script>