//Make Your own Distro by #include-ing this file.

#define STD_DISTRO_DVD_CONFIG   "TB\nScale2Mem(2048,0x40000)\nT\n\n1024\n768\n\n\n"

U0 MakeMyISO(U8 *_out_iso_filename)
{//Does everything with current drive.
//If you have not recompiled Kernel and defined your CD/DVD drive, use Mount.

    U8 *out_iso_filename = FileNameAbs(_out_iso_filename);
    I64 line_count = LineRep("/*", "-r") + LineRep("/System/*") + LineRep("/Compiler/*", "-S+$") + LineRep("/Kernel/*");

    if (!DriveIsWritable)
    {
        "Drive must be writable.    Install on Hard drive, first.\n";
        return;
    }

    DocTreeFWrite("/System/Define.CC", "LineRep", "DefinePrint(\"DD_ZEALOS_LOC\",\"%,d\");\n", line_count);
    DefinePrint("DD_ZEALOS_LOC", "%,d", line_count);

    "Total LOC:%12,d\n\n", line_count;

    DelTree("/Distro");
    Del(out_iso_filename);

    // Generate all HTML docs before ISO creation.
    PopUpRunFile("::/Home/HtmlGen.CC");
    ProgressBarsReset;

    progress1_max = 14;
    StrCopy(progress1_desc, "Copying files to /Distro");

    DirMake("/Distro");
    In(STD_DISTRO_DVD_CONFIG);
    BootDVDIns;
    progress1++;

    Copy("/*", "/Distro");
    progress1++;
    DirMake("/Distro" BOOT_DIR);
    Move(BOOT_DIR_DVD_KERNEL_BIN_C, "/Distro" BOOT_DIR_KERNEL_BIN_C);
    progress1++;
    CopyTree("/Home",       "/Distro/Home");
    progress1++;
    Del("/Distro/Home/Registry.CC");
    CopyTree("/System",     "/Distro/System");
    progress1++;
    CopyTree("/Apps",       "/Distro/Apps");
    progress1++;
    CopyTree("/Compiler",   "/Distro/Compiler");
    progress1++;
    CopyTree("/Demo",       "/Distro/Demo");
    progress1++;
    CopyTree("/Doc",        "/Distro/Doc");
    progress1++;
    CopyTree("/Kernel",     "/Distro/Kernel");
    progress1++;
    CopyTree("/Misc",       "/Distro/Misc");
    progress1++;

    //To save space, optionally delete dictionary.
    //Del("/Distro/System/AutoComplete/ACDefs.DATA");
    CopyTree("/Downloads", "/Distro/Downloads");        //You can leave this out.
    progress1++;
    DirMake("/Distro/Tmp");
    DirMake("/Distro/Tmp/ScreenShots");
    progress1++;
    StrCopy(progress1_desc, "Building ISO");
    RedSeaISO(out_iso_filename, "/Distro", "/Distro" BOOT_DIR_KERNEL_BIN_C);
    progress1++;

    //If CD-ROM use MT_CD instead of MT_DVD.
    //DVDImageWrite('T',out_iso_filename,MT_DVD); //Uncomment to burn.

    DelTree("/Distro");
    ProgressBarsReset;
    Free(out_iso_filename);
}

MakeMyISO("/Tmp/MyDistro.ISO.C");

// Study the account examples Config Strs, Update Funs.