if (!is_dir("{$logsPath}/fixes")) { system_call("mkdir {$logsPath}/fixes"); } if (!is_dir("/Extra/Extensions.EDPFix")) { system_call("mkdir /Extra/Extensions.EDPFix"); } else { system_call("rm -rf /Extra/Extensions.EDPFix/*"); } writeToLog("{$buildLogPath}/build.log", "<br> Cleaning up last build...<br>"); system_call("rm -Rf /Extra/Extensions/*"); // // Step 1 : Create the folder path and download the model data // writeToLog("{$buildLogPath}/build.log", "<br><b>Step 1) Prepare essential files download:</b><br>"); writeToLog("{$buildLogPath}/build.log", " Preparing myhack...</b><br>"); myHackCheck(); global $modelNamePath; $modelRowID = 0; $modelName = $modeldb[$modelRowID]["name"]; $ven = $edpDBase->builderGetVendorValuebyID($sysType, $modelID); $gen = $edpDBase->builderGetGenValuebyID($sysType, $modelID); // use old method if there are is no generation column in db if ($gen == "") { $modelNamePath = "{$modelName}"; if (!is_dir("{$workPath}/model-data/{$modelName}/")) { system("mkdir {$workPath}/model-data/{$modelName}"); } // system_call("svn --non-interactive --username osxlatitude-edp-read-only list http://osxlatitude-edp.googlecode.com/svn/model-data/$modelName/common >> $buildLogPath/build.log 2>&1"); $svnLoad->PrepareEssentialFilesDownload("{$modelName}"); } else { $modelNamePath = "{$ven}/{$gen}/{$modelName}";
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>"; }
function doCustomBuild() { $workPath = "/Extra/EDP"; $incPath = "/Extra/include"; $eePath = "/Extra/Extensions"; $buildLogPath = "{$workPath}/logs/build"; // // Create log directory for build // if (!is_dir("{$workPath}/logs")) { system_call("mkdir {$workPath}/logs"); } // // Clear build log files // if (!is_dir("{$buildLogPath}")) { system_call("mkdir {$buildLogPath}"); } else { system_call("rm -rf {$buildLogPath}/*"); } $cusoper = $_POST['copchoice']; $edpoper = $_POST['eopchoice']; $dsdt = $_POST['dsdt']; $boot = $_POST['boot']; $smbios = $_POST['smbios']; $ssdt = $_POST['ssdt']; $ssdt1 = $_POST['ssdt1']; $ssdt2 = $_POST['ssdt2']; $ssdt3 = $_POST['ssdt3']; $ssdt4 = $_POST['ssdt4']; // // check if myhack.kext exists in sle, if it dosent then copy it there... // myHackCheck(); // writeToLog("$buildLogPath/build.log", "Choice: $cusoper, $edpoper<br>"); if ($cusoper == "cfullfix") { // Create myFix text file to start myFix process writeToLog("{$buildLogPath}/fullFix.txt", ""); // Launch the script which provides the summary of the build process echo "<script> document.location.href = 'workerapp.php?action=showCustomBuildLog'; </script>"; } else { if ($cusoper == "cfixcache" || $edpoper == "ebuild" && $cusoper == "cnone") { // Create myFix text file to start myFix process writeToLog("{$buildLogPath}/quickFix.txt", ""); // Launch the script which provides the summary of the build process echo "<script> document.location.href = 'workerapp.php?action=showCustomBuildLog'; </script>"; } else { if ($cusoper != "cnone") { // For log time date_default_timezone_set("UTC"); $date = date("d-m-y H-i"); system_call("echo '<br>*** Custom build logging started on: {$date} UTC Time ***' >> {$buildLogPath}/build.log"); // // Step 1 // writeToLog("{$buildLogPath}/build.log", "<br><br><b>Step 1) Checking if you have selected any kexts from {$incPath}... </b><br>"); // Get all the kexts name in comma seperated way $cclinfo = shell_exec("ls -m /Extra/include/Extensions/"); $cckarray = explode(',', $cclinfo); $pckid = 100; foreach ($cckarray as $ccfkname) { if ($ccfkname != "") { $ccfkname = preg_replace('/\\s+/', '', $ccfkname); //remove white spaces if ($_POST[$pckid] == "on") { system("cp -R /Extra/include/Extensions/{$ccfkname} {$eePath}"); writeToLog("{$buildLogPath}/build.log", "Copying {$ccfkname} to {$eePath}<br>"); } else { if (is_dir("/Extra/Extensions/{$ccfkname}")) { system("rm -rf /Extra/Extensions/{$ccfkname}"); writeToLog("{$buildLogPath}/build.log", "Removing {$ccfkname} from {$eePath}<br>"); } } } $pckid++; } // // Step 2 // writeToLog("{$buildLogPath}/build.log", "<br><b>Step 2) Checking if you have essential files DSDT, SSDT and plists from {$incPath}... </b><br>"); if ($dsdt == "on") { writeToLog("{$buildLogPath}/build.log", "DSDT file found, Copying {$incPath}/DSDT.aml to /Extra<br>"); system_call("cp -f /Extra/include/DSDT.aml /Extra"); } if (is_file("/Extra/include/SSDT.aml") && $ssdt == "on") { writeToLog("{$buildLogPath}/build.log", "SSDT files(s) found, Copying SSDT.aml file to /Extra<br>"); system_call("cp -f /Extra/include/SSDT.aml /Extra"); } if (is_file("/Extra/include/SSDT-1.aml") && $ssdt1 == "on") { writeToLog("{$buildLogPath}/build.log", "Copying SSDT-1.aml file to /Extra<br>"); system_call("cp -f /Extra/include/SSDT-1.aml /Extra"); } if (is_file("/Extra/include/SSDT-2.aml") && $ssdt2 == "on") { writeToLog("{$buildLogPath}/build.log", "Copying SSDT-2.aml file to /Extra<br>"); system_call("cp -f /Extra/include/SSDT-2.aml /Extra"); } if (is_file("/Extra/include/SSDT-3.aml") && $ssdt3 == "on") { writeToLog("{$buildLogPath}/build.log", "Copying SSDT-3.aml file to /Extra<br>"); system_call("cp -f /Extra/include/SSDT-3.aml /Extra"); } if (is_file("/Extra/include/SSDT-4.aml") && $ssdt4 == "on") { writeToLog("{$buildLogPath}/build.log", "Copying SSDT-4.aml file to /Extra<br>"); system_call("cp -f /Extra/include/SSDT-4.aml /Extra"); } if ($boot == "on") { writeToLog("{$buildLogPath}/build.log", "Chameleon plist found, Copying {$incPath}/org.chameleon.Boot.plist to /Extra<br>"); system_call("cp -f /Extra/include/org.chameleon.Boot.plist /Extra"); } if ($smbios == "on") { writeToLog("{$buildLogPath}/build.log", "SMBios file found, Copying {$incPath}/SMBios.plist to /Extra<br>"); system_call("cp -f /Extra/include/smbios.plist /Extra"); } // // Step 3 // writeToLog("{$buildLogPath}/build.log", "<br><b>Step 3) Calling myFix to copy kexts and generate kernelcache... </b><br>"); // End build log and create a lastbuild log system_call("echo '<br>*** Custom build logging ended on: {$date} UTC Time ***<br>' >> {$buildLogPath}/build.log"); system_call("cp {$buildLogPath}/build.log {$workPath}/logs/lastbuild.log "); // Append current build log to the builds log $fileContents = file_get_contents("{$buildLogPath}/build.log"); file_put_contents("{$workPath}/logs/build.log", $fileContents, FILE_APPEND | LOCK_EX); // Create myFix text file to start myFix process writeToLog("{$buildLogPath}/quickFix.txt", ""); // Launch the script which provides the summary of the build process echo "<script> document.location.href = 'workerapp.php?action=showCustomBuildLog'; </script>"; } } } }
function patchWiFiBTBCM4352($log, $pathToPatch, $genCache) { global $slePath, $workPath; writeToLog("{$log}", " Applying WiFi patches for BCM4352 card...<br>"); if (!file_exists("{$slePath}/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/Info.plist")) { writeToLog("{$log}", " IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext kext not found<br>"); system_call("cd {$workPath}/logs/fixes; touch patchFail.txt;"); return; } switch ($pathToPatch) { case "SLE": // Binary patches system_call('sudo perl -pi -e \'s|\\x01\\x58\\x54|\\x01\\x55\\x53|g\' /System/Library/Extensions/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/MacOS/AirPortBrcm4360'); // region code change to US system_call('sudo perl -pi -e \'s|\\x6B\\x10\\x00\\x00\\x75|\\x6B\\x10\\x00\\x00\\x74|g\' /System/Library/Extensions/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/MacOS/AirPortBrcm4360'); // skipping binary checks of apple device id to work Appple card system_call('sudo perl -pi -e \'s|\\x6B\\x10\\x00\\x00\\x0F\\x85|\\x6B\\x10\\x00\\x00\\x0F\\x84|g\' /System/Library/Extensions/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/MacOS/AirPortBrcm4360'); // skipping binary checks of apple device id to work Appple card // Kext patch system_call("sudo /usr/libexec/PlistBuddy -c \"add IOKitPersonalities:Broadcom\\ 802.11\\ PCI:IONameMatch:0 string \"pci14e4,43b1\"\" /System/Library/Extensions/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/Info.plist"); // touch for kernel cache if ($genCache == "yes") { KextsPermissionsAndKernelCacheFix($log, "SLE"); // system_call("sudo touch /System/Library/Extensions/ >> $log &"); } break; case "EE": system_call("cp -a {$slePath}/IO80211Family.kext /Extra/Extensions.EDPFix/"); system_call("cp -a {$slePath}/IO80211Family.kext/Contents/PlugIns/. /Extra/Extensions.EDPFix/"); system_call("rm -rf /Extra/Extensions.EDPFix/IO80211Family.kext/Contents/PlugIns"); // Binary patches system_call('sudo perl -pi -e \'s|\\x01\\x58\\x54|\\x01\\x55\\x53|g\' /Extra/Extensions.EDPFix/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/MacOS/AirPortBrcm4360'); // region code change to US system_call('sudo perl -pi -e \'s|\\x6B\\x10\\x00\\x00\\x75|\\x6B\\x10\\x00\\x00\\x74|g\' /Extra/Extensions.EDPFix/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/MacOS/AirPortBrcm4360'); // skipping binary checks of apple device id to work Appple card system_call('sudo perl -pi -e \'s|\\x6B\\x10\\x00\\x00\\x0F\\x85|\\x6B\\x10\\x00\\x00\\x0F\\x84|g\' /Extra/Extensions.EDPFix/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/MacOS/AirPortBrcm4360'); // skipping binary checks of apple device id to work Appple card // Kext patch system_call("sudo /usr/libexec/PlistBuddy -c \"add IOKitPersonalities:Broadcom\\ 802.11\\ PCI:IONameMatch:0 string \"pci14e4,43b1\"\" /Extra/Extensions.EDPFix/IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/Info.plist"); UpdateKextVersions("{$workPath}/logs/build/build.log"); if ($genCache == "yes") { myHackCheck(); KextsPermissionsAndKernelCacheFix($log, "EE"); // system_call("sudo myfix -q -t / >> $log &"); } break; } writeToLog("{$log}", " WiFi kext/binary patched successfullly for BCM4352 card<br>"); system_call("touch {$workPath}/logs/fixes/patchSuccess.txt;"); }