Пример #1
0
/**
 * get number of CPU
 *
 * @return bool
 */
function getcpucores()
{
    $nums = system_call();
    if ($nums === -1) {
        return false;
    }
    return $nums;
}
Пример #2
0
 public function copyChamModules($chamModConfig)
 {
     global $workPath;
     $modpathFROM = "{$workPath}/bin/modules";
     $modpathTO = "/Extra/modules/";
     if (!is_dir("/Extra/modules")) {
     }
     system_call("mkdir /Extra/modules");
     //Cleaning existing modules folder
     system_call("rm -Rf /Extra/modules/*");
     //Copying modules
     if ($chamModConfig['ACPICodec'] == "on") {
         system_call("cp -Rf {$modpathFROM}/ACPICodec.dylib {$modpathTO}");
     }
     if ($chamModConfig['FileNVRAM'] == "on") {
         system_call("cp -Rf {$modpathFROM}/FileNVRAM.dylib {$modpathTO}");
     }
     if ($chamModConfig['KernelPatcher'] == "on") {
         system_call("cp -Rf {$modpathFROM}/KernelPatcher.dylib {$modpathTO}");
     }
     if ($chamModConfig['Keylayout'] == "on") {
         system_call("cp -Rf {$modpathFROM}/Keylayout.dylib {$modpathTO}");
     }
     if ($chamModConfig['klibc'] == "on") {
         system_call("cp -Rf {$modpathFROM}/klibc.dylib {$modpathTO}");
     }
     if ($chamModConfig['Resolution'] == "on") {
         system_call("cp -Rf {$modpathFROM}/Resolution.dylib {$modpathTO}");
     }
     if ($chamModConfig['Sata'] == "on") {
         system_call("cp -Rf {$modpathFROM}/Sata.dylib {$modpathTO}");
     }
     if ($chamModConfig['uClibcxx'] == "on") {
         system_call("cp -Rf {$modpathFROM}/uClibcxx.dylib {$modpathTO}");
     }
     if ($chamModConfig['HDAEnabler'] == "on") {
         system_call("cp -Rf {$modpathFROM}/HDAEnabler.dylib {$modpathTO}");
     }
 }
         echo "<ul class='pageitem'>";
         echo "<img src=\"icons/big/warning.png\" style=\"width:80px;height:80px;position:relative;left:50%;top:50%;margin:15px 0 0 -35px;\">";
         echo "<b><center> File not found.</b><br><br><b> Copy your bootloader file to {$incPath} and try again.</center></b>";
         echo "<br></ul></div>";
     }
 } elseif ($chameID != "") {
     // Clear log and scripts
     if (is_dir("{$logsPath}/update")) {
         system_call("rm -rf {$logsPath}/update/*");
     }
     // Create local directory if not found
     if (!is_dir("{$svnpackPath}")) {
         system_call("mkdir {$svnpackPath}");
     }
     if (!is_dir("{$svnpackPath}/Bootloader")) {
         system_call("mkdir {$svnpackPath}/Bootloader");
     }
     $type = $chameBootdb[$chameID]['type'];
     $fname = $chameBootdb[$chameID]['foldername'];
     // Download the bootloader
     if ($type == "Enoch") {
         $svnLoad->svnDataLoader("Update", "Bootloader/EnochBoot", $fname);
     } else {
         $svnLoad->svnDataLoader("Update", "Bootloader/StandardBoot", $fname);
     }
     // Start installation process by Launching the script which provides the summary of the build process
     echo "<script> document.location.href = 'workerapp.php?type={$type}&fname={$fname}&action=showChameUpdateLog'; </script>";
 } else {
     echo "<div class='pageitem_bottom'>\n";
     echo "<ul class='pageitem'>";
     echo "<img src=\"icons/big/warning.png\" style=\"width:80px;height:80px;position:relative;left:50%;top:50%;margin:15px 0 0 -35px;\">";
Пример #4
0
            break;
    }
    // Start installation process by Launching the script which provides the summary of the build process
    echo "<script> document.location.href = 'workerapp.php?fixInfoKeys={$fixInfoKeys}&fixInfoValues={$fixInfoValues}&action=showFixLog'; </script>";
} elseif ($action == "Patch") {
    $fixLogPath = "{$logsPath}/fixes";
    // Clear logs and scripts
    if (is_dir("{$fixLogPath}")) {
        system_call("rm -rf {$fixLogPath}/*");
    }
    // create log directory if not found
    if (!is_dir("{$logsPath}")) {
        system_call("mkdir {$logsPath}");
    }
    if (!is_dir("{$fixLogPath}")) {
        system_call("mkdir {$fixLogPath}");
    }
    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");
Пример #5
0
 function svnDataLoader($logType, $categ, $fname)
 {
     global $workPath, $svnpackPath, $edp;
     switch ($logType) {
         case "AppsTools":
             $logPath = "{$workPath}/logs/apps";
             // create app local download directory if not found
             if (!is_dir("{$workPath}/apps")) {
                 system_call("mkdir {$workPath}/apps");
             }
             if (!is_dir("{$workPath}/apps/{$categ}")) {
                 system_call("mkdir {$workPath}/apps/{$categ}");
             }
             $dataDir = "{$workPath}/apps/{$categ}";
             $svnpath = "apps/{$categ}/{$fname}";
             $logName = "appInstall";
             break;
         case "Kexts":
             $logPath = "{$workPath}/logs/build";
             // create fix local download directory if not found
             if (!is_dir("{$svnpackPath}")) {
                 system_call("mkdir {$svnpackPath}");
             }
             if (!is_dir("{$svnpackPath}/{$categ}")) {
                 system_call("mkdir {$svnpackPath}/{$categ}");
             }
             $dataDir = "{$svnpackPath}/{$categ}";
             $svnpath = "kextpacks/{$categ}/{$fname}";
             $logName = "kextInstall";
             break;
         case "Update":
             $logPath = "{$workPath}/logs/update";
             // create update local download directory if not found
             if (!is_dir("{$svnpackPath}")) {
                 system_call("mkdir {$svnpackPath}");
             }
             if (!is_dir("{$svnpackPath}/{$categ}")) {
                 system_call("mkdir {$svnpackPath}/{$categ}");
             }
             $dataDir = "{$svnpackPath}/{$categ}";
             $svnpath = "kextpacks/{$categ}/{$fname}";
             $logName = "packUpdateLog";
             break;
         case "Fixes":
             $logPath = "{$workPath}/logs/fixes";
             // create fix local download directory if not found
             if (!is_dir("{$svnpackPath}")) {
                 system_call("mkdir {$svnpackPath}");
             }
             if (!is_dir("{$svnpackPath}/{$categ}")) {
                 system_call("mkdir {$svnpackPath}/{$categ}");
             }
             $dataDir = "{$svnpackPath}/{$categ}";
             $svnpath = "kextpacks/{$categ}/{$fname}";
             $logName = "fixInstall";
             break;
     }
     // create log directory if not found
     if (!is_dir("{$workPath}/logs")) {
         system_call("mkdir {$workPath}/logs");
     }
     if (!is_dir("{$logPath}")) {
         system_call("mkdir {$logPath}");
     }
     //
     // Run download script (which downloads data from SVN) in background to download asynchronously
     // (synchronous which is without background download has freezing problem and
     //  we can't provide download status in php due to no multhreading)
     //
     if (is_dir("{$dataDir}/{$fname}")) {
         $checkoutCmd = "if ping -q -c 2 google.com; then if svn --non-interactive --username edp --password edp --quiet --force update {$dataDir}/{$fname}; then echo \"{$fname} file(s) updated finished<br>\"; touch {$logPath}/Success_{$fname}.txt; fi else echo \"{$fname} file(s) update failed due to no internet<br>\"; touch {$logPath}/Fail_{$fname}.txt; fi";
         writeToLog("{$logPath}/{$fname}.sh", "{$checkoutCmd};");
         system_call("sh {$logPath}/{$fname}.sh >> {$logPath}/{$logName}.log &");
     } else {
         $checkoutCmd = "cd {$dataDir}; if ping -q -c 2 google.com; then if svn --non-interactive --username osxlatitude-edp-read-only --quiet --force co http://osxlatitude-edp.googlecode.com/svn/{$svnpath}; then echo \"{$fname} file(s) download finished<br>\"; touch {$logPath}/Success_{$fname}.txt; fi else echo \"{$fname} file(s) download failed due to no internet<br>\"; touch {$logPath}/Fail_{$fname}.txt; fi";
         writeToLog("{$logPath}/{$fname}.sh", "{$checkoutCmd};");
         system_call("sh {$logPath}/{$fname}.sh >> {$logPath}/{$logName}.log &");
     }
 }
Пример #6
0
         // Choose new version
         if (getMacOSXVersion() >= "10.8.5") {
             $svnLoad->svnDataLoader("Kexts", "{$row['category']}", "GenericXHCIUSB3_New");
             $kInfoValues = "{$id},GenericXHCIUSB3_New,{$row['name']},{$row['icon']},{$row['category']},{$installPath}";
         } else {
             if (getMacOSXVersion() < "10.8.5") {
                 $svnLoad->svnDataLoader("Kexts", "{$row['category']}", "{$row['foldername']}");
             }
         }
     } else {
         $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}";
Пример #7
0
		<a href='<?php 
    echo "{$row['link']}";
    ?>
'>Project/Support Link</a>
		</div>
		<ul class="pageitem">
			<li class="button"><input name="Submit input" type="submit" value="<?php 
    echo $buttonValue;
    ?>
" /></li>
		</ul>
		
		<?php 
    echo "<input type='hidden' name='id' value='{$id}'>";
    echo "<input type='hidden' name='action' value='{$action}'>";
    echo "<input type='hidden' name='category' value='{$categ}'>";
    ?>

		</form>
		<?php 
} elseif ($action == "Install") {
    // Start installation process by Launching the script which provides the summary of the build process
    echo "<script> document.location.href = 'workerapp.php?id={$id}&foldername={$row['foldername']}&name={$row['name']}&icon={$row['icon']}&action=showAppsLog'; </script>";
    // Clear logs and scripts
    if (is_dir("{$logsPath}/apps")) {
        system_call("rm -rf {$logsPath}/apps/*");
    }
    global $svnLoad;
    // Download app
    $svnLoad->svnDataLoader("AppsTools", "{$row['menu']}", "{$row['foldername']}");
}
        $dScript = preg_replace('/\\s+/', '', $dScript);
        //remove white spaces in name
        if ($dScript != "") {
            system_call("sh {$buildLogPath}/dLoadScripts/{$dScript} >> {$buildLogPath}/internetCheckLog.log &");
        }
    }
}
//-------------------------> Here starts the Vendor and model selector - but only if $action is empty
if ($action == "") {
    //
    // Clear build log files
    //
    if (!is_dir("{$buildLogPath}")) {
        system_call("mkdir {$buildLogPath}");
    } else {
        system_call("rm -rf {$buildLogPath}/*");
    }
    // Write out the top menu
    echoPageItemTOP("icons/big/config.png", "Select a model your wish to configure for:");
    echo "<div class='pageitem_bottom'>\n";
    echo "EDP internal database contains 'best practice' configuration for the systems - this makes it easy to to choose the right configuration. However, you always have the option to ajust the configuration before doing a build. <br><br>Doing a build means that EDP will copy a combination of kexts, dsdt, plists, fixes and patches needed to boot your system.";
    include "header.inc.php";
    echo "<p><span class='graytitle'></span><ul class='pageitem'><li class='select'>";
    echo "<select name='type' id='type'>";
    if ($sysType == "") {
        echo "<option value='' selected>&nbsp;&nbsp;Select system type...</option>\n";
    } else {
        echo "<option value='' selected>&nbsp;&nbsp;Select system type...</option>\n";
    }
    echo $edpDBase->getSystemTypeValue();
    echo "</select><span class='arrow'></span> </li>";
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>";
            }
        }
    }
}
Пример #10
0
 public function updateDB()
 {
     global $workPath;
     echo "\nUpdating database... <br><br>\n";
     system_call("rm -Rf {$workPath}/bin/edp.sqlite3");
     system_call("curl -o {$workPath}/bin/edp.sqlite3 http://www.osxlatitude.com/dbupdate.php");
 }
Пример #11
0
function showUpdateLog()
{
    $workPath = "/Extra/EDP";
    // can't use global path (using makes update to break)
    // For log time
    date_default_timezone_set("UTC");
    $date = date("d-m-y H-i");
    $updLogPath = "{$workPath}/logs/update";
    if (is_file("{$updLogPath}/updateFinish.log")) {
        system_call("mv {$updLogPath}/updateFinish.log {$workPath}/logs/lastupdate.log ");
        system("sudo killall EDP");
        system("open {$workPath}/bin/EDPweb.app");
        exit;
    }
    echoPageItemTOP("icons/big/update.png", "EDP Update");
    echo "<body onload=\"JavaScript:timedRefresh(8000);\">";
    echo "<div class='pageitem_bottom'\">";
    if (is_file("{$updLogPath}/Updsuccess.txt") || is_file("{$updLogPath}/Updfail.txt")) {
        echo "<ul class='pageitem'>";
        if (file_exists("{$updLogPath}/Updsuccess.txt")) {
            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> Update success.</b><br><br><b> Please wait 10 sec... the App will reload for the new changes to take effect.</center></b>";
            echo "<br></ul>";
            system_call("echo '<br>*** Logging ended on: {$date} UTC Time ***<br>' >> {$updLogPath}/update.log");
            system_call("mv {$updLogPath}/update.log {$updLogPath}/updateFinish.log ");
            echo "<b>Update Log:</b>\n";
            echo "<pre>";
            if (is_file("{$updLogPath}/updateFinish.log")) {
                include "{$updLogPath}/updateFinish.log";
            }
            echo "</pre>";
            // Append current update log to the updates log
            $fileContents = file_get_contents("{$updLogPath}/updateFinish.log");
            file_put_contents("{$workPath}/logs/update.log", $fileContents, FILE_APPEND | LOCK_EX);
            echo "<body onload=\"JavaScript:timedRefresh(8000);\">";
            echo "<script type=\"text/JavaScript\"> function timedRefresh(timeoutPeriod) { logVar = setTimeout(\"location.reload(true);\", timeoutPeriod); } </script>\n";
        } else {
            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> Update failed.</b><br><br><b> Check the log for the reason.</center></b>";
            echo "<br></ul>";
            echo "<b>Update Log:</b>\n";
            echo "<pre>";
            if (is_file("{$updLogPath}/update.log")) {
                include "{$updLogPath}/update.log";
            }
            echo "</pre>";
            system_call("echo '<br>*** Logging ended on: {$date} UTC Time ***<br>' >> {$updLogPath}/update.log");
            system_call("mv {$updLogPath}/update.log {$workPath}/logs/lastupdate.log ");
            // Append current update log to the updates log
            $fileContents = file_get_contents("{$workPath}/logs/lastupdate.log");
            file_put_contents("{$workPath}/logs/update.log", $fileContents, FILE_APPEND | LOCK_EX);
        }
        echo "</div>";
    } else {
        echo "<center><b>Please wait for few minutes while we download the updates... 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>";
    }
}
Пример #12
0
function copyCustomFiles()
{
    //Get vars from config.inc.php
    global $workPath, $rootPath, $slePath, $incPath, $os, $eePath, $modelNamePath;
    global $modeldb, $modelRowID;
    // model path
    $modelDirPath = "{$workPath}/model-data/{$modelNamePath}";
    $extrapath = "/Extra";
    writeToLog("{$workPath}/logs/build/build.log", " Checking for Custom files from EDP model database... <br>");
    //
    // Check if we need a custom version of chameleon from essential common and $os folders
    //
    if ($modeldb[$modelRowID]['customCham'] == "on") {
        $cboot = "{$modelDirPath}/common/boot";
        $osboot = "{$modelDirPath}/{$os}/boot";
        if (is_file("{$cboot}") || is_file("{$osboot}")) {
            writeToLog("{$workPath}/logs/build/build.log", "  Custom chameleon found, copied to {$rootPath} <br>");
            system_call("rm -f {$rootPath}/boot");
            system_call("cp {$modelDirPath}/common/boot {$rootPath}");
            system_call("cp {$modelDirPath}/{$os}/boot {$rootPath}");
        }
    }
    //
    // Check if we need a custom made kernel from EDP model kernel folder
    //
    if (is_dir("{$modelDirPath}/kernel/kernel{$os}")) {
        $ckernel = "{$modelDirPath}/kernel/kernel{$os}/custom_kernel";
        if (is_file("{$ckernel}")) {
            writeToLog("{$workPath}/logs/build/build.log", "  Custom kernel found, copied to {$rootPath} <br>");
            system_call("rm -f {$rootPath}/custom_kernel");
            system_call("cp {$modelDirPath}/kernel/kernel{$os}/custom_kernel {$rootPath}");
        }
        $kernelos = "{$modelDirPath}/kernel/kernel{$os}/mach_kernel";
        if (is_file("{$kernelos}")) {
            writeToLog("{$workPath}/logs/build/build.log", "  Custom mach_kernel found, copied to {$rootPath} <br>");
            system_call("rm -f {$rootPath}/mach_kernel");
            system_call("cp {$modelDirPath}/kernel/kernel{$os}/mach_kernel {$rootPath}");
        }
    }
    writeToLog("{$workPath}/logs/build/build.log", " Checking for user provided custom files from {$incPath}... <br>");
    //
    // Copy essentials from /Extra/include if user has
    //
    if (is_file("{$incPath}/smbios.plist") && $modeldb[$modelRowID]["useIncSMBIOS"] == "on") {
        writeToLog("{$workPath}/logs/build/build.log", "  Custom smbios.plist found, Copied from {$incPath} to {$extrapath}<br>");
        system_call("cp -f {$incPath}/smbios.plist /Extra");
    }
    if (is_file("{$incPath}/org.chameleon.Boot.plist") && $modeldb[$modelRowID]["useIncCHAM"] == "on") {
        writeToLog("{$workPath}/logs/build/build.log", "  Custom org.chameleon.Boot.plist found, Copied from {$incPath} to {$extrapath}<br>");
        system_call("cp -f {$incPath}/org.chameleon.Boot.plist /Extra");
    }
    if (is_file("{$incPath}/dsdt.aml") && $modeldb[$modelRowID]["useIncDSDT"] == "on") {
        writeToLog("{$workPath}/logs/build/build.log", "  Custom dsdt file found, Copied from {$incPath} to {$extrapath}<br>");
        system_call("cp -f {$incPath}/dsdt.aml /Extra");
    }
    if ($modeldb[$modelRowID]["useIncSSDT"] == "on") {
        if (is_file("{$incPath}/SSDT.aml")) {
            writeToLog("{$workPath}/logs/build/build.log", "  Custom SSDT files found, Copied from {$incPath} to {$extrapath}<br>");
            system_call("cp -f {$incPath}/SSDT.aml /Extra");
        }
        if (is_file("{$incPath}/SSDT-1.aml")) {
            system_call("cp -f {$incPath}/SSDT-1.aml /Extra");
        }
        if (is_file("{$incPath}/SSDT-2.aml")) {
            system_call("cp -f {$incPath}/SSDT-2.aml /Extra");
        }
        if (is_file("{$incPath}/SSDT-3.aml")) {
            system_call("cp -f {$incPath}/SSDT-3.aml /Extra");
        }
        if (is_file("{$incPath}/SSDT-4.aml")) {
            system_call("cp -f {$incPath}/SSDT-4.aml /Extra");
        }
        if (is_file("{$incPath}/SSDT-5.aml")) {
            system_call("cp -f {$incPath}/SSDT-5.aml /Extra");
        }
    }
    //
    // Copy Custom Themes folder from $incpatch to /Extra
    //
    if (is_file("{$workPath}/logs/build/dLoadScripts/CopyCustomTheme.sh") && shell_exec("cd {$incPath}/Themes; ls | wc -l") > 0) {
        if (is_dir("{$incPath}/Themes")) {
            writeToLog("{$workPath}/logs/build/build.log", "  Custom themes folder found, copied to /Extra<br>");
            system_call("rm -rf /Extra/Themes");
            system_call("mkdir /Extra/Themes");
            system_call("cp -a {$incPath}/Themes/. /Extra/Themes/");
        }
    }
    //
    // Copying Custom kexts from include if CopyCustomKexts file exists
    //
    if (is_file("{$workPath}/logs/build/dLoadScripts/CopyCustomKexts.sh") && shell_exec("cd {$incPath}/Extensions; ls | wc -l") > 0) {
        writeToLog("{$workPath}/logs/build/build.log", "  Custom kexts found, copied to /Extra<br>");
        system_call("cp -a {$incPath}/Extensions/. {$eePath}/");
        //If AppleHDA is found in Extra/include then remove VoodooHDA from ee
        if (file_exists("{$incPath}/Extensions/AppleHDA.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");
            }
            system_call("rm -rf {$eePath}/VoodooHDA.kext");
            system_call("rm -rf {$eePath}/AppleHDADisabler.kext");
            writeToLog("{$workPath}/logs/build/build.log", "  Found AppleHDA from {$incPath}, VoodooHDA files will be removed if exists<br>");
        }
    }
}