示例#1
0
 echo "<div class='pageitem_bottom'\">";
 echo "<ul class='pageitem'>";
 $fixToSLE = $_POST['fixToSLE'];
 switch ($row[foldername]) {
     case "AppleIntelCPUPowerManagement":
         if ($fixToSLE == "on") {
             patchAppleIntelCPUPowerManagement("{$fixLogPath}/fix.log", "SLE", "yes");
         } else {
             patchAppleIntelCPUPowerManagement("{$fixLogPath}/fix.log", "EE", "yes");
         }
         break;
     case "BCM4352WiFiPatches":
         if ($fixToSLE == "on") {
             patchWiFiBTBCM4352("{$fixLogPath}/fix.log", "SLE", "yes");
         } else {
             patchWiFiBTBCM4352("{$fixLogPath}/fix.log", "EE", "yes");
         }
         break;
     case "AR9285AR9287WiFiPatch":
         if ($fixToSLE == "on") {
             patchWiFiAR9285AndAR9287("{$fixLogPath}/fix.log", "SLE", "yes");
         } else {
             patchWiFiAR9285AndAR9287("{$fixLogPath}/fix.log", "EE", "yes");
         }
         break;
     case "VGA_HDMI_Intel_HD3000_Patch":
         if ($fixToSLE == "on") {
             patchAppleIntelSNBGraphicsFB("{$fixLogPath}/fix.log", "SLE", "yes");
         } else {
             patchAppleIntelSNBGraphicsFB("{$fixLogPath}/fix.log", "EE", "yes");
         }
function PrepareEDPKextpacks()
{
    //Get vars from config.inc.php
    global $workPath, $svnpackPath, $rootPath, $slePath, $modelNamePath, $eePath;
    global $ps2db, $audiodb, $wifidb, $cpufixdb, $batterydb, $landb, $fakesmcdb;
    global $modeldb, $modelRowID;
    global $os;
    //Get our class(s)
    global $builder;
    global $svnLoad;
    // model path
    $modelDirPath = "{$workPath}/model-data/{$modelNamePath}";
    // Use EDP Kexts?
    if ($modeldb[$modelRowID]['useEDPExtensions'] == "on") {
        //
        // copying PS2 kexts from kextpacks
        //
        $ps2id = $modeldb[$modelRowID]['ps2pack'];
        if ($ps2id != "" && $ps2id != "no") {
            $fname = $ps2db[$ps2id]["foldername"];
            // remove installed kexts before
            if (is_dir("/Extra/Extensions/VoodooPS2Controller.kext")) {
                system_call("rm -rf /Extra/Extensions/VoodooPS2Controller.kext");
            }
            if (is_dir("/Extra/Extensions/ApplePS2Controller.kext")) {
                system_call("rm -rf /Extra/Extensions/ApplePS2Controller.kext");
            }
            if (is_dir("/Extra/Extensions/AppleACPIPS2Nub.kext")) {
                system_call("rm -rf /Extra/Extensions/AppleACPIPS2Nub.kext");
            }
            if (is_dir("/Extra/Extensions/ApplePS2ElanTouchpad.kext")) {
                system_call("rm -rf /Extra/Extensions/ApplePS2ElanTouchpad.kext");
            }
            // remove voodooPS2 files if its installed before for non-voodoo install
            if ($ps2id != "2" && $ps2id != "5" && $ps2id != "6") {
                if (is_dir("/Library/PreferencePanes/VoodooPS2.prefpane")) {
                    system_call("rm -rf /Library/PreferencePanes/VoodooPS2.prefpane");
                }
                if (file_exists("/usr/bin/VoodooPS2Daemon")) {
                    system_call("rm -rf /usr/bin/VoodooPS2Daemon");
                }
                if (file_exists("/Library/LaunchDaemons/org.rehabman.voodoo.driver.Daemon.plist")) {
                    system_call("rm -rf /Library/LaunchDaemons/org.rehabman.voodoo.driver.Daemon.plist");
                }
                if (is_dir("/Library/PreferencePanes/VoodooPS2synapticsPane.prefPane")) {
                    system_call("rm -rf /Library/PreferencePanes/VoodooPS2synapticsPane.prefPane");
                }
            }
            if ($fname != "") {
                writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Touchpad kext {$fname}...<br>");
                if (!is_dir("{$svnpackPath}/PS2Touchpad")) {
                    system_call("mkdir {$svnpackPath}/PS2Touchpad");
                }
                $svnLoad->PrepareKextpackDownload("PS2Touchpad", "{$fname}", "{$fname}");
            }
        }
        // Reset vars
        $name = "";
        $fname = "";
        //
        // copying Wifi/BT kexts from kextpacks / patch WiFi/BT Kexts
        //
        if ($modeldb[$modelRowID]['wifipack'] != "" && $modeldb[$modelRowID]['wifipack'] != "no") {
            $wifid = $modeldb[$modelRowID]['wifipack'];
            $name = $wifidb[$wifid]['name'];
            $fname = $wifidb[$wifid]['foldername'];
            if ($name != "") {
                switch ($wifid) {
                    case 0:
                        writeToLog("{$workPath}/logs/build/build.log", " Patching WiFi kext for {$name}...<br>");
                        patchWiFiAR9285AndAR9287("{$workPath}/logs/build/build.log", "EE", "no");
                        break;
                    case 1:
                        writeToLog("{$workPath}/logs/build/build.log", " Patching WiFi kext for {$name}...<br>");
                        if (getMacOSXVersion() >= "10.8.5") {
                            patchWiFiBTBCM4352("{$workPath}/logs/build/build.log", "EE", "no");
                        } else {
                            writeToLog("{$workPath}/logs/build/build.log", "  OSX version is not supported for WiFi, need OSX 10.8.5 or later<br>");
                        }
                        break;
                    case 2:
                        writeToLog("{$workPath}/logs/build/build.log", " Preparing to download rollback WiFi kext {$fname}...<br>");
                        if (!is_dir("{$svnpackPath}/Wireless")) {
                            system_call("mkdir {$svnpackPath}/Wireless");
                        }
                        $svnLoad->PrepareKextpackDownload("Wireless", "{$fname}", "{$fname}");
                        break;
                }
                // Load Bluetooth kext for AR3011 and BCM4352
                if ($wifid < "3") {
                    writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Bluetooth kext {$fname}...<br>");
                    if (!is_dir("{$svnpackPath}/Wireless")) {
                        system_call("mkdir {$svnpackPath}/Wireless");
                    }
                    $svnLoad->PrepareKextpackDownload("Wireless", "BluetoothFWUploader", "BluetoothFWUploader.kext");
                }
            }
        }
        // Reset vars
        $name = "";
        $fname = "";
        //
        // copying fakesmc kexts from kextpacks
        //
        if ($modeldb[$modelRowID]['fakesmc'] != "" && $modeldb[$modelRowID]['fakesmc'] != "no") {
            $fakesmcid = $modeldb[$modelRowID]['fakesmc'];
            $fname = $fakesmcdb[$fakesmcid]['foldername'];
            $name = $fakesmcdb[$fakesmcid]['name'];
            if ($fname != "") {
                writeToLog("{$workPath}/logs/build/build.log", " Preparing to download FakeSMC kext {$fname}...<br>");
                if (!is_dir("{$svnpackPath}/FakeSMC")) {
                    system_call("mkdir {$svnpackPath}/FakeSMC");
                }
                $svnLoad->PrepareKextpackDownload("FakeSMC", "{$fname}", "{$name}");
            }
        }
        // Reset vars
        $name = "";
        $fname = "";
        //
        // copying audio kexts
        //
        if ($modeldb[$modelRowID]['audiopack'] != "" && $modeldb[$modelRowID]['audiopack'] != "no") {
            $audioid = $modeldb[$modelRowID]['audiopack'];
            $fname = $audiodb[$audioid]['foldername'];
            $name = $audiodb[$audioid]['name'];
            // Remove HDA Enabler
            if (is_dir("{$slePath}/HDAEnabler.kext")) {
                system_call("rm -Rf {$slePath}/HDAEnabler.kext");
            }
            //
            // Check for AppleHDA
            //
            $usingAppleHDA = "";
            switch ($audioid) {
                case "sl":
                case "lion":
                case "ml":
                case "mav":
                case "yos":
                    global $modelID, $edp_db;
                    global $os, $sysType;
                    switch ($sysType) {
                        case "Mobile Workstation":
                        case "Notebook":
                        case "Ultrabook":
                        case "Tablet":
                            $applehda = $edp_db->query("SELECT * FROM applehdaNB WHERE model_id = '{$modelID}'");
                            break;
                        case "Desktop":
                        case "Workstation":
                        case "AllinOnePC":
                            $applehda = $edp_db->query("SELECT * FROM applehdaDesk WHERE model_id = '{$modelID}'");
                            break;
                    }
                    foreach ($applehda as $row) {
                        $aID = explode(',', $row[$audioid]);
                        if (getVersion() >= $aID[1]) {
                            writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Audio kext patched {$audioid} AppleHDA...<br>");
                            if (!is_dir("{$modelDirPath}/applehda")) {
                                system_call("mkdir {$modelDirPath}/applehda");
                            }
                            $svnLoad->PrepareKextpackDownload("Extensions", "audiocommon", "{$modelNamePath}/applehda");
                            $svnLoad->PrepareKextpackDownload("Extensions", "audio{$audioid}", "{$modelNamePath}/applehda");
                            $usingAppleHDA = "yes";
                        } else {
                            writeToLog("{$workPath}/logs/build/build.log", " Chosen Patched AppleHDA is not supported in this OSX version, using latest VoodooHDA instead<br>");
                        }
                    }
                case "no":
                    //
                    // Remove voodooHDA related files if installed before
                    //
                    if (is_dir("{$slePath}/VoodooHDA.kext")) {
                        system_call("rm -Rf {$slePath}/VoodooHDA.kext");
                    }
                    if (is_dir("{$slePath}/AppleHDADisabler.kext")) {
                        system_call("rm -Rf {$slePath}/AppleHDADisabler.kext");
                    }
                    if (is_dir("/Applications/VoodooHdaSettingsLoader.app")) {
                        system_call("rm -rf /Applications/VoodooHdaSettingsLoader.app");
                    }
                    if (file_exists("/Library/LaunchAgents/com.restore.voodooHDASettings.plist")) {
                        system_call("rm -rf /Library/LaunchAgents/com.restore.voodooHDASettings.plist");
                    }
                    if (is_dir("/Library/PreferencePanes/VoodooHDA.prefPane")) {
                        system_call("rm -rf /Library/PreferencePanes/VoodooHDA.prefPane");
                    }
                    break;
            }
            //
            // Check for VoodooHDA
            //
            if ($fname != "" && $usingAppleHDA == "") {
                writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Audio kext {$fname}...<br>");
                if (!is_dir("{$svnpackPath}/Audio")) {
                    system_call("mkdir {$svnpackPath}/Audio");
                }
                $svnLoad->PrepareKextpackDownload("Audio", "{$fname}", "{$name}");
                // Copy Prefpane and Settings loader
                $svnLoad->PrepareKextpackDownload("Audio", "Settings", "AudioSettings");
            }
        }
        // Reset vars
        $name = "";
        $fname = "";
        //
        // copying ethernet kexts from kextpacks
        //
        if ($modeldb[$modelRowID]['ethernet'] != "" && $modeldb[$modelRowID]['ethernet'] != "no") {
            $lanid = $modeldb[$modelRowID]['ethernet'];
            $name = $landb[$lanid]['name'];
            $fname = $landb[$lanid]['foldername'];
            if ($fname != "") {
                writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Ethernet kext {$name}...<br>");
                if (!is_dir("{$svnpackPath}/Ethernet")) {
                    system_call("mkdir {$svnpackPath}/Ethernet");
                }
                // Category folder
                if (!is_dir("{$svnpackPath}/Ethernet/{$fname}")) {
                    system_call("mkdir {$svnpackPath}/Ethernet/{$fname}");
                }
                // New Realtek kext
                if ($lanid == "11") {
                    // Choose 10.8+ version
                    if (getMacOSXVersion() >= "10.8") {
                        $svnLoad->PrepareKextpackDownload("Ethernet", "{$fname}", "RealtekRTL8111");
                    } else {
                        if (getMacOSXVersion() == "10.7") {
                            $svnLoad->PrepareKextpackDownload("Ethernet", "{$fname}", "RealtekRTL8111_Lion");
                        }
                    }
                } else {
                    $svnLoad->PrepareKextpackDownload("Ethernet", "{$fname}", "{$name}");
                }
            }
        }
        // Reset vars
        $name = "";
        $fname = "";
        //
        // copying battery kexts from kextpacks
        //
        if ($modeldb[$modelRowID]['batterypack'] != "" && $modeldb[$modelRowID]['batterypack'] != "no") {
            $battid = $modeldb[$modelRowID]['batterypack'];
            $fname = $batterydb[$battid]['foldername'];
            $name = $batterydb[$battid]['name'];
            if ($fname != "") {
                writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Battery kext {$name}...<br>");
                if (!is_dir("{$svnpackPath}/Battery")) {
                    system_call("mkdir {$svnpackPath}/Battery");
                }
                $svnLoad->PrepareKextpackDownload("Battery", "{$fname}", "{$name}");
            }
        }
        // Reset vars
        $name = "";
        $fname = "";
    } else {
        writeToLog("{$workPath}/logs/build/build.log", " Skipping Standard Kexts from EDP on user request<br>");
    }
    //
    // Copy selected optional kexts
    //
    $data = $modeldb[$modelRowID]['optionalpacks'];
    $array = explode(',', $data);
    global $edpDBase;
    foreach ($array as $id) {
        $opdata = $edpDBase->getKextpackDataFromID("optionalpacks", $id);
        $categ = $opdata[category];
        $fname = $opdata[foldername];
        $name = $opdata[name];
        if ($fname != "") {
            writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Optional pack {$name}...<br>");
            if (!is_dir("{$svnpackPath}/{$categ}")) {
                system_call("mkdir {$svnpackPath}/{$categ}");
            }
            // Generic XHCI USB3.0
            if ($id == "5") {
                // Choose new version
                if (getMacOSXVersion() >= "10.8.5") {
                    $svnLoad->PrepareKextpackDownload("{$categ}", "GenericXHCIUSB3_New", "{$name}");
                } else {
                    if (getMacOSXVersion() < "10.8.5") {
                        $svnLoad->PrepareKextpackDownload("{$categ}", "{$fname}", "{$name}");
                    }
                }
            } else {
                $svnLoad->PrepareKextpackDownload("{$categ}", "{$fname}", "{$name}");
            }
        }
    }
    // Reset vars
    $name = "";
    $fname = "";
    writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Standard kexts... <br>");
    //
    // Standard kexts
    //
    if (!is_dir("{$workPath}/svnpacks/Standard")) {
    }
    system_call("mkdir {$workPath}/svnpacks/Standard");
    $svnLoad->PrepareKextpackDownload("Standard", "common", "Standard common");
    $svnLoad->PrepareKextpackDownload("Standard", "{$os}", "Standard {$os}");
    writeToLog("{$workPath}/logs/build/build.log", " Preparing to download Model specific kexts... <br>");
    //
    // From Model data (Extensions folder)
    //
    $svnLoad->PrepareKextpackDownload("Extensions", "kextscommon", "{$modelNamePath}/Extensions");
    $svnLoad->PrepareKextpackDownload("Extensions", "kexts{$os}", "{$modelNamePath}/Extensions");
    // From Model data (Common and $os folder used before, have to remove this when all the models updated to new Extensions folder)
    if (is_dir("{$modelDirPath}/common/Extensions")) {
        writeToLog("{$workPath}/logs/build/build.log", "  Copying kexts from model common folder to {$eePath}<br>");
        $tf = "{$modelDirPath}/common/Extensions";
        system_call("cp -a {$tf}/. {$eePath}/");
    }
    if (is_dir("{$modelDirPath}/{$os}/Extensions")) {
        writeToLog("{$workPath}/logs/build/build.log", "  Copying kexts from model {$os} folder to {$eePath}<br>");
        $tf = "{$modelDirPath}/{$os}/Extensions";
        system_call("cp -a {$tf}/. {$eePath}/");
    }
    //
    // Download custom kernel from EDP
    //
    $svnLoad->PrepareKextpackDownload("Kernel", "kernel{$os}", "{$modelNamePath}/Kernel");
    //
    // Create a script file if we need to copy kexts from Extra/include/Extensions
    //
    if ($modeldb[$modelRowID]["useIncExtensions"] == "on") {
        writeToLog("{$workPath}/logs/build/dLoadScripts/CopyCustomKexts.sh", "");
    }
}