function showKextsLog($InstallData)
{
    global $workPath, $svnpackPath, $edp_db;
    if ($InstallData[categ] != "Ethernet") {
        echoPageItemTOP("icons/big/{$InstallData['icon']}", "{$InstallData['name']}");
    } else {
        echoPageItemTOP("icons/big/{$InstallData['icon']}", "{$InstallData['foldername']}");
    }
    echo "<body onload=\"JavaScript:timedRefresh(8000);\">";
    echo "<div class='pageitem_bottom'\">";
    $buildLogPath = "{$workPath}/logs/build";
    if (is_file("{$buildLogPath}/Success_{$InstallData['foldername']}.txt") || is_file("{$buildLogPath}/Fail_{$InstallData['foldername']}.txt")) {
        //
        // Install the downloaded kext
        //
        if (file_exists("{$buildLogPath}/Success_{$InstallData['foldername']}.txt")) {
            // Download kext
            switch ($InstallData[categ]) {
                case "PS2Touchpad":
                    // Remove installed kexts which might cause problems
                    if (is_dir("{$InstallData['path']}/VoodooPS2Controller.kext")) {
                        system_call("rm -rf {$InstallData['path']}/VoodooPS2Controller.kext");
                    }
                    if (is_dir("{$InstallData['path']}/ApplePS2Controller.kext")) {
                        system_call("rm -rf {$InstallData['path']}/ApplePS2Controller.kext");
                    }
                    if (is_dir("{$InstallData['path']}/AppleACPIPS2Nub.kext")) {
                        system_call("rm -rf {$InstallData['path']}/AppleACPIPS2Nub.kext");
                    }
                    if (is_dir("{$InstallData['path']}/ApplePS2ElanTouchpad.kext")) {
                        system_call("rm -rf {$InstallData['path']}/ApplePS2ElanTouchpad.kext");
                    }
                    $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['foldername']}";
                    break;
                case "Audio":
                    $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['foldername']}";
                    // Copy prefpane and settings loader
                    if (is_file("{$buildLogPath}/Success_Settings.txt") || is_file("{$buildLogPath}/Fail_Settings.txt")) {
                        system_call("cp -rf {$svnpackPath}/{$InstallData['categ']}/Settings/VoodooHdaSettingsLoader.app /Applications/; cp -f {$svnpackPath}/{$InstallData['categ']}/Settings/com.restore.voodooHDASettings.plist /Library/LaunchAgents/; cp -rf {$svnpackPath}/{$InstallData['categ']}/Settings/VoodooHDA.prefPane /Library/PreferencePanes/;");
                    } else {
                        echo "<center><b>Please wait for few minutes while we download and install the kext... which will take approx 1 to 10 minutes depending on your internet speed.</b></center>";
                        echo "<img src=\"icons/big/loading.gif\" style=\"width:200px;height:30px;position:relative;left:50%;top:50%;margin:15px 0 0 -100px;\">";
                        echo "<script type=\"text/JavaScript\"> function timedRefresh(timeoutPeriod) { logVar = setTimeout(\"location.reload(true);\",timeoutPeriod); } function stopRefresh() { clearTimeout(logVar); } </script>\n";
                        echo "</div>";
                        return;
                    }
                    break;
                case "USB":
                    // Generic XHCI USB3.0
                    if ($InstallData[id] == "5") {
                        // Choose new version
                        if (getMacOSXVersion() >= "10.8.5") {
                            $kPath = "{$svnpackPath}/{$InstallData['categ']}/GenericXHCIUSB3_New";
                        } else {
                            if (getMacOSXVersion() < "10.8.5") {
                                $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['foldername']}";
                            }
                        }
                    } else {
                        $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['foldername']}";
                    }
                    break;
                case "Ethernet":
                    // New Realtek kext
                    if ($InstallData[id] == "11") {
                        // Choose 10.8+ version
                        if (getMacOSXVersion() >= "10.8") {
                            $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['name']}/RealtekRTL8111";
                        } else {
                            if (getMacOSXVersion() == "10.7") {
                                $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['name']}/RealtekRTL8111_Lion";
                            }
                        }
                    } else {
                        $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['name']}/{$InstallData['foldername']}";
                    }
                    break;
                default:
                    $kPath = "{$svnpackPath}/{$InstallData['categ']}/{$InstallData['foldername']}";
                    break;
            }
            system_call("cp -rf {$kPath}/*.kext {$InstallData['path']}/");
            if ($InstallData[path] == "/Extra/Extensions") {
                myHackCheck();
                ProcessKextConflicts("{$buildLogPath}/kextInstall.log");
                KextsPermissionsAndKernelCacheFix("{$buildLogPath}/kextInstall.log", "EE");
                // system_call("sudo myfix -q -t / >> $buildLogPath/myFix.log &");
            } else {
                myHackCheck();
                ProcessKextConflicts("{$buildLogPath}/kextInstall.log");
                KextsPermissionsAndKernelCacheFix("{$buildLogPath}/kextInstall.log", "SLE");
            }
            echo "<ul class='pageitem'>";
            echo "<img src=\"icons/big/success.png\" style=\"width:80px;height:80px;position:relative;left:50%;top:50%;margin:15px 0 0 -35px;\">";
            echo "<b><center> Installation finished.</b><br><br><b> You can see the changes in action from your next boot.</center></b>";
            echo "<br></ul>";
        } else {
            echo "<ul class='pageitem'>";
            echo "<img src=\"icons/big/fail.png\" style=\"width:80px;height:80px;position:relative;left:50%;top:50%;margin:15px 0 0 -35px;\">";
            echo "<b><center> Installation failed.</b><br><br><b> Check the log for the reason.</center></b>";
            echo "<br></ul>";
            echo "<b>Log:</b>\n";
            echo "<pre>";
            if (is_file("{$buildLogPath}/kextInstall.log")) {
                include "{$buildLogPath}/kextInstall.log";
            }
            echo "</pre>";
        }
        echo "</div>";
        exit;
    } else {
        echo "<center><b>Please wait for few minutes while we download and install the kext... which will take approx 1 to 10 minutes depending on your internet speed.</b></center>";
        echo "<img src=\"icons/big/loading.gif\" style=\"width:200px;height:30px;position:relative;left:50%;top:50%;margin:15px 0 0 -100px;\">";
    }
    echo "<script type=\"text/JavaScript\"> function timedRefresh(timeoutPeriod) { logVar = setTimeout(\"location.reload(true);\",timeoutPeriod); } function stopRefresh() { clearTimeout(logVar); } </script>\n";
    echo "</div>";
}
Beispiel #2
0
                $svnLoad->svnDataLoader("Kexts", "{$row['category']}", "{$row['foldername']}");
            }
            break;
        case "lan":
            if (!is_dir("{$svnpackPath}/Ethernet")) {
                system_call("mkdir {$svnpackPath}/Ethernet");
            }
            //
            // name and foldername values are swapped due to Extra category folder of Ethernet
            // so we can check the status of the kext download
            //
            $kInfoValues = "{$id},{$row['name']},{$row['foldername']},{$row['icon']},{$row['category']},{$installPath}";
            // New Realtek kext
            if ($id == "11") {
                // Choose 10.8+ version
                if (getMacOSXVersion() >= "10.8") {
                    $svnLoad->svnDataLoader("Kexts", "Ethernet/{$row['foldername']}", "RealtekRTL8111");
                } else {
                    if (getMacOSXVersion() == "10.7") {
                        $svnLoad->svnDataLoader("Kexts", "Ethernet/{$row['foldername']}", "RealtekRTL8111_Lion");
                        $kInfoValues = "{$id},RealtekRTL8111_Lion,{$row['foldername']},{$row['icon']},{$row['category']},{$installPath}";
                    }
                }
            } else {
                $svnLoad->svnDataLoader("Kexts", "Ethernet/{$row['foldername']}", "{$row['name']}");
            }
            break;
    }
    // Start installation process by Launching the script which provides the summary of the build process
    echo "<script> document.location.href = 'workerapp.php?kInfoKeys={$kInfoKeys}&kInfoValues={$kInfoValues}&action=showKextsLog'; </script>";
}
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", "");
    }
}