<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion='1'>
    <platforms>
        <client arch="i386"/>
        <server arch="i386"/>
    </platforms>
    <title>SU_TITLE</title>
    <options hostArchitectures='i386' customize='never' rootVolumeOnly='true'/>
    <choices-outline>
        <line choice='manual'/>
    </choices-outline>
    <choices-outline ui='SoftwareUpdate'>
        <line choice='su'/>
    </choices-outline>
    <choice id='manual' title='SU_TITLE' versStr='SU_VERS'>
        <pkg-ref auth='Root' id='manual'>#MacBookProFirmwareUpdate.pkg</pkg-ref>
    </choice>
    <choice id='su' suDisabledGroupID='MacBookProFirmwareUpdate'>
        <pkg-ref auth='Root' id='su'>MacBookProFirmwareUpdate.pkg</pkg-ref>
    </choice>
    <choice id='su' visible='VisibleCheck()'/>
    <choice id='su' start_selected='true'/>
    <choice id='su' title='SU_TITLE' versStr='SU_VERS'/>
    <choice id='su' description='SU_DESCRIPTION' description-mime-type='text/html'/>
    <installation-check script='InstallationCheck()'/>
    <volume-check script='VolumeCheck()'/>
    <script>
	
	function InstallationCheck()
	{
        if ( !isValidMachine() || !hasValidEFI() ) {
            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.type = 'Fatal';
            return false;	       
        }

		if (my.target.systemVersion.ProductBuildVersion.substring(0,2) == "9F" &amp;&amp;
			-1 == system.compareVersions(my.target.systemVersion.ProductBuildVersion.substring(2), '2114')) {
            my.result.message = system.localizedStringWithFormat('ERR_INSTALL');
            my.result.type = 'Fatal';
            return false;	       
		}
                
        if ( !isNotDowngrade() ) {
            my.result.message = system.localizedStringWithFormat('ERR_HW');
            my.result.type = 'Fatal';
            return false;	       
        }
        
        return true;
	}

    function VisibleCheck()
	{
        return ( hasValidEFI() &amp;&amp; isValidMachine() );
    }

    function hasOS()
    {
        if (!system.files.fileExistsAtPath(my.target.mountpoint + "/System/Library/CoreServices/SystemVersion.plist")) {
			my.result.message = system.localizedStringWithFormat('ERR_OS');
			return false;
		}
		return true;
    }

    function hasOSVer()
    {
		if (-1 == system.compareVersions(my.target.systemVersion.ProductVersion, '10.5.5')) {
			my.result.message = system.localizedStringWithFormat('ERR_OS');
		    return false;
		}
        return true;
    }
        
    function hasValidEFI()
    {
        var obj = system.ioregistry.fromPath("IODeviceTree:/rom@0");
        if (obj) {
            var property = obj.version;
            if (property &amp;&amp;
				 (property == "MBP51.88Z.0074.B00.0810241236") ||
				 (property == "MBP51.88Z.0073.B02.0810061244") ||
				 (property == "MBP51.88Z.0073.B00.0809221733")) {
				return true;
			}
        }    
        
        return false;
    }

    function isValidMachine()
    {
        var property = system.sysctl("hw.model");
        if (property &amp;&amp; (property == "MacBookPro5,1")) {
            return true;
        }
        
        return false;
    }
        
    function isNotDowngrade()
    {
        var action = null;
        if (choices.manual) {
            action = choices.manual.packageUpgradeAction;
        }
        else {
            action = choices.su.packageUpgradeAction;
        }
        
        if ((action == 'downgrade') || (action == 'mixed')) {
            return false;
        }
        
        return true;
    }
	
	</script>
    <conclusion file="Conclusion.rtf"/>
    <license file="License.rtf" sla="EA0325"/>
    <background file="background.tif"/>
    <localization>
        <strings language="pl"><![CDATA["SU_TITLE" = "Uaktualnienie oprogramowania sprzętowego EFI MacBooka Pro";
"SU_VERS" = "1.6";
"SU_SERVERCOMMENT" = "Dla komputerów stacjonarnych oraz 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>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Lucida Grande}
span.s1 {text-decoration: underline ; color: #002ce2}
</style>
</head>
<body>
<p class="p1">To uaktualnienie poprawia stabilność komputerów MacBook Pro oraz rozwiązuje problemy związane z usypianiem/budzeniem, a także zgodnością urządzeń oraz USB.</p>
<p class="p1">Wersja Boot ROM po zainstalowaniu oprogramowania sprzętowego w Macintoshu:<br>
MBP51.0074.B01</p>
<p class="p1">Nową wersję Boot ROM zainstalowaną w Twoim komputerze można potwierdzić w programie Profil systemu.</p>
<p class="p1">Więcej informacji na temat tego uaktualnienia można znaleźć pod adresem: <a href="http://docs.info.apple.com/article.html?artnum=303364-pl"><span class="s1">http://docs.info.apple.com/article.html?artnum=303364-pl</span></a></p>
</body>
</html>
';
]]></strings>
    </localization>

	<pkg-ref id='su' installKBytes='5027' version='1.6.1.1226961742'/>
</installer-gui-script>