--- anaconda/installclass.py.orig	2006-04-02 10:44:46.000000000 -0500
+++ anaconda/installclass.py	2006-04-02 10:56:02.000000000 -0500
@@ -21,6 +21,7 @@
 from instdata import InstallData
 from partitioning import *
 from autopart import getAutopartitionBoot, autoCreatePartitionRequests, autoCreateLVMPartitionRequests
+import kadischi
 
 from rhpl.translate import _, N_
 
@@ -116,6 +117,7 @@
 		 "installtype",
 		 "iscsi",
 		 "zfcpconfig",
+                 "kadischi", # Kadischi method
                  "partitionmethod",
                  "partitionobjinit",
                  "partitionmethodsetup",
@@ -186,6 +188,12 @@
         # Ask for iscsi configuration only when specifically requested
         if not flags.iscsi:
              dispatch.skipStep("iscsi", skip = 1)
+
+        # Kadischi method
+        if kadischi.fromStages1_2() == True:
+            dispatch.skipStep("kadischi", permanent=1)
+        if kadischi.livecdFromSystem() == False or kadischi.systemFromLivecd() == False:
+            dispatch.skipStep("kadischi", permanent=1)
 		
         # if there's only one install class, it doesn't make much sense
         # to show it
--- anaconda/gui.py.orig	2006-04-02 10:44:46.000000000 -0500
+++ anaconda/gui.py	2006-04-02 10:45:41.000000000 -0500
@@ -63,6 +63,7 @@
     "installtype" : ("installpath_gui", "InstallPathWindow"),
     "iscsi" : ("iscsi_gui", "iscsiWindow"),
     "zfcpconfig" : ("zfcp_gui", "ZFCPWindow"),
+    "kadischi" : ("kadischi_gui", "KadischiWindow"), # Kadischi method
     "partitionmethod" : ("partmethod_gui", "PartitionMethodWindow"),
     "partition" : ("partition_gui", "PartitionWindow"),
     "parttype" : ("autopart_type", "PartitionTypeWindow"),
--- anaconda/dispatch.py.orig	2006-04-02 10:44:46.000000000 -0500
+++ anaconda/dispatch.py	2006-04-02 10:45:41.000000000 -0500
@@ -68,6 +68,7 @@
     ("installtype", ("dispatch", "id", "method", "intf")),
     ("iscsi", ("id.iscsi", "intf")),
     ("zfcpconfig", ("id.zfcp", "id.diskset", "intf")),
+    ("kadischi", ("method", "instPath")), # Kadischi step
     ("partitionobjinit", partitionObjectsInitialize, ("id.diskset",
                                                       "id.partitions",
                                                       "dir", "intf",
--- anaconda/text.py.orig	2006-04-02 10:44:46.000000000 -0500
+++ anaconda/text.py	2006-04-02 10:45:41.000000000 -0500
@@ -43,6 +43,7 @@
     "welcome" : ("welcome_text", "WelcomeWindow"),
     "installtype" : ("installpath_text", "InstallPathWindow"),
     "iscsi" : ("iscsi_text", "iscsiWindow"),
+    "kadischi" : ("kadischi_text", "KadischiWindow"), # Kadischi method
     "parttype" : ("partition_text", "PartitionTypeWindow"),    
     "custom-upgrade" : ("upgrade_text", "UpgradeExamineWindow"),
     "addswap" : ("upgrade_text", "UpgradeSwapWindow"),
--- anaconda/iutil.py.orig	2006-04-02 10:44:46.000000000 -0500
+++ anaconda/iutil.py	2006-04-02 10:45:41.000000000 -0500
@@ -17,6 +17,7 @@
 import os.path
 import rhpl, rhpl.executil
 from flags import flags
+import kadischi
 
 import logging
 log = logging.getLogger("anaconda")
@@ -405,6 +406,7 @@
 
 # make the device-mapper control node
 def makeDMNode(root="/"):
     major = minor = None
 
     for (fn, devname, val) in ( ("/proc/devices", "misc", "major"),
@@ -425,14 +427,22 @@
 #    print "major is %s, minor is %s" %(major, minor)
     if major is None or minor is None:
         return
-    mkdirChain(root + "/dev/mapper")
-    isys.mknod(root + "/dev/mapper/control", stat.S_IFCHR | 0600,
-               isys.makedev(major, minor))
+    if kadischi.livecdFromSystem() == True or kadischi.systemFromLivecd() == True:
+        mkdirChain(root + "/tmp/dev/mapper")
+        isys.mknod(root + "/tmp/dev/mapper/control", stat.S_IFCHR | 0600,
+                   isys.makedev(major, minor))
+    else:
+        mkdirChain(root + "/dev/mapper")
+        isys.mknod(root + "/dev/mapper/control", stat.S_IFCHR | 0600,
+                   isys.makedev(major, minor))
 
 # make some miscellaneous character device nodes 
 def makeCharDeviceNodes():
     for dev in ["input/event0", "input/event1", "input/event2", "input/event3"]:
-        isys.makeDevInode(dev, "/dev/%s" % (dev,))
+        if kadischi.livecdFromSystem() == True or kadischi.systemFromLivecd() == True:
+            isys.makeDevInode(dev, "/tmp/dev/%s" % (dev,))
+        else:
+            isys.makeDevInode(dev, "/dev/%s" % (dev,))
 
 # make the device nodes for all of the drives on the system
 def makeDriveDeviceNodes():
@@ -442,7 +452,10 @@
     for drive in hardDrives.keys():
         if drive.startswith("mapper"):
             continue
-        isys.makeDevInode(drive, "/dev/%s" % (drive,))
+        if kadischi.livecdFromSystem() == True or kadischi.systemFromLivecd() == True:
+            isys.makeDevInode(drive, "/tmp/dev/%s" % (drive,))
+        else:
+            isys.makeDevInode(drive, "/dev/%s" % (drive,))
 
         if drive.startswith("hd"):
             num = 32
@@ -459,11 +472,17 @@
 
         for i in range(1, num):
             dev = "%s%s%d" % (drive, sep, i)
-            isys.makeDevInode(dev, "/dev/%s" % (dev,))
+            if kadischi.livecdFromSystem() == True or kadischi.systemFromLivecd() == True:
+                isys.makeDevInode(dev, "/tmp/dev/%s" % (dev,))
+            else:
+                isys.makeDevInode(dev, "/dev/%s" % (dev,))
 
     cdroms = isys.cdromList()
     for drive in cdroms:
-        isys.makeDevInode(drive, "/dev/%s" % (drive,))
+        if kadischi.livecdFromSystem() == True or kadischi.systemFromLivecd() == True:
+            isys.makeDevInode(drive, "/tmp/dev/%s" % (drive,))
+        else:
+            isys.makeDevInode(drive, "/dev/%s" % (drive,))
 
     for mdMinor in range(0, 32):
         md = "md%d" %(mdMinor,)
--- anaconda/kadischi.py.orig	2006-04-02 10:46:37.000000000 -0500
+++ anaconda/kadischi.py	2006-04-02 10:45:41.000000000 -0500
@@ -0,0 +1,114 @@
+# kadischi.py
+# 
+# Definitions for handling
+# LiveCD creation
+# or System installation from LiveCD
+
+import os
+import sys
+import re
+import string
+import shutil
+import rpm
+from rhpl.log import log
+
+
+def fromStages1_2():
+    if os.path.isfile('/sbin/loader') or os.path.isdir('/modules'):
+        return True
+    else:
+        return False
+
+
+def livecdFromSystem():
+    if fromStages1_2() == False:
+        for line in os.popen('grep READONLY /etc/sysconfig/readonly-root').readlines():
+            if line.startswith('READONLY=no') and not os.path.isfile('/.livecd'):
+                return True
+            else:
+                return False
+
+   
+def systemFromLivecd():
+    if fromStages1_2() == False:
+        for line in os.popen('grep READONLY /etc/sysconfig/readonly-root').readlines():
+            if line.startswith('READONLY=yes') and os.path.isfile('/.livecd'):
+                return True
+            else:
+                return False
+
+
+def createLivecdFromSystem(method, instPath, isoimage, fstype, productPath):
+    if os.stat(instPath) == 0:
+        os.rename(instPath, instPath + '-oldXXX')
+            continue
+
+    if fromStages1_2() == False and livecdFromSystem == True:
+        if os.path.isfile(isoimage):
+            os.remove(isoimage)
+                continue
+
+    # Check required packages installed
+    # possibly set allowedFileSystems[] from which GTK fstypes
+    # menu can be born
+    if fstype == ('SquashFS'):
+       fstools = ('squashfs-tools')
+    if fstype == ('zISOFS'):
+       fstools = ('zisofs-tools')
+
+    requiredrpms = ('busybox-anaconda', 'mkisofs', 'syslinux', 'e2fsprogs', fstools)
+    missingrpms = checkInstalledRpms('/', requiredrpms, False)
+
+    if len(missingrpms) != 0:
+        for rpm in missingrpms:
+            log(("Required package: %s missing!") % rpm)
+        log("Aborting execution.")
+        sys.exit(1)
+    
+    # Validify the method, Anaconda already does this I'm sure. 
+    validateRpmRepo(method)
+
+    
+            
+def checkInstalledRpms(rootdir, requiredrpms, cleardb = True)
+    missingrpms = []
+    if cleardb = True:
+        clearRpmDbFiles(rootdir)
+    ts = rpm.TransactionSet(rootdir)
+    for package in requiredrpms:
+        mi = ts.dbMatch('name', package)
+        if mi.count() == 0:
+            missingrpms.append(package)
+    if cleardb:
+        clearRpmDbFiles(rootdir)
+    
+    return missingrpms
+
+###
+### Config file sections deprectaed in favor of
+### GTK UI user interaction, selectability
+### possible random generation of instPath
+### in /tmp
+###
+
+def validateRpmRepo():
+    validrepo = True
+    
+    if method.find(":") == -1:
+        method = normalizePath([method])
+        validrepo = pathExists(method) and pathExists(method + '/' + productPath)
+                and pathExists(method + '/' + productPath + '/' + 'base') and
+                pathExists(method + '/' + productPath + '/' + 'RPMS')
+    elif method.find("http" == 0 or method.find("ftp") == 0:
+        method = method.rstrip("/")
+        validrepo = urlExists(method) and urlExists(method + '/' + productPath) and
+        urlExists(method + '/' + productPath + '/' + 'base') and
+        urlExists(method + '/' + productPath + '/' + 'RPMS')
+    
+    if validrepo:
+        log("Repository validated, success.")
+    else:
+        log("Repository is invalid, aborting execution.")
+        sys.exit(1)
+
+# End of Kadischi module
--- anaconda/anaconda.orig	2006-04-02 10:44:01.000000000 -0500
+++ anaconda/anaconda	2006-04-02 11:04:41.000000000 -0500
@@ -633,6 +633,22 @@
 	    if len(cargs[1]) > 0:
 		vncconnectport = cargs[1]
 
+# 
+# Set up LiveCD/DVD cases
+# Creating a LiveCD from System
+# Installing a System from LiveCD
+#
+import kadischi
+if kadischi.livecdFromSystem() == True or kadischi.systemFromLivecd() == True:
+# This is a really fuzzy area, considering kadischi_text.py and kadischi_gui.py
+    flags.rootpath = 1
+# This could be randomly generated using some seed from /dev/urandom
+# likewise an temporary path can also be supplied by the user.. unless
+# using --cmdline and/or --kickstart in which cases one could be generated
+# in /tmp if one isn't specified. Seems like it would be safe.
+    rootPath = "/tmp/anaconda-livecd"
+# End of Kadischi section
+
 #
 # must specify install, rescue mode
 #
@@ -1177,16 +1193,17 @@
 
 # Skip the disk options in rootpath mode
 if flags.rootpath:
-    dispatch.skipStep("partitionobjinit", permanent = 1)
-    dispatch.skipStep("parttype", permanent = 1)
-    dispatch.skipStep("autopartitionexecute", permanent = 1)
-    dispatch.skipStep("partition", permanent = 1)
-    dispatch.skipStep("partitiondone", permanent = 1)
-    dispatch.skipStep("bootloadersetup", permanent = 1)
-    dispatch.skipStep("bootloader", permanent = 1)
-    dispatch.skipStep("bootloaderadvanced", permanent = 1)
-    dispatch.skipStep("upgbootloader", permanent = 1)
-    dispatch.skipStep("instbootloader", permanent = 1)
+    if kadischi.livecdFromSystem() == True:
+        dispatch.skipStep("partitionobjinit", permanent = 1)
+        dispatch.skipStep("parttype", permanent = 1)
+        dispatch.skipStep("autopartitionexecute", permanent = 1)
+        dispatch.skipStep("partition", permanent = 1)
+        dispatch.skipStep("partitiondone", permanent = 1)
+        dispatch.skipStep("bootloadersetup", permanent = 1)
+        dispatch.skipStep("bootloader", permanent = 1)
+        dispatch.skipStep("bootloaderadvanced", permanent = 1)
+        dispatch.skipStep("upgbootloader", permanent = 1)
+        dispatch.skipStep("instbootloader", permanent = 1)
 
 # set up the headless case
 if isHeadless == 1:
