Index: livecd/creator/livecd-creator
===================================================================
--- livecd.orig/creator/livecd-creator
+++ livecd/creator/livecd-creator
@@ -325,48 +325,11 @@ class InstallationTarget:
         if not self.repos:
             raise InstallationError("No repositories specified")
 
-    def base_on_iso(self, base_on):
-        """helper function to extract ext3 file system from a live CD ISO"""
-
-        isoloop = LoopbackMount(base_on, "%s/base_on_iso" %(self.build_dir,))
-
-        squashloop = LoopbackMount("%s/squashfs.img" %(isoloop.mountdir,),
-                                   "%s/base_on_squashfs" %(self.build_dir,),
-                                   "squashfs")
-
-        try:
-            try:
-                isoloop.mount()
-            except MountError, e:
-                raise InstallationError("Failed to loopback mount '%s' : %s" % (base_on, e))
-
-            if not os.path.exists(squashloop.lofile):
-                raise InstallationError("'%s' is not a valid live CD ISO : squashfs.img doesn't exist" % base_on)
-
-            try:
-                squashloop.mount()
-            except MountError, e:
-                raise InstallationError("Failed to loopback mount squashfs.img from '%s' : %s" % (base_on, e))
-
-            os_image = self.build_dir + "/base_on_squashfs/os.img"
-
-            if not os.path.exists(os_image):
-                raise InstallationError("'%s' is not a valid live CD ISO : os.img doesn't exist" % base_on)
-
-            shutil.copyfile(os_image, self.build_dir + "/data/os.img")
-        finally:
-            # unmount and tear down the mount points and loop devices used
-            squashloop.cleanup()
-            isoloop.cleanup()
+    def base_on(self, base_on):
+        pass
 
     def write_fstab(self):
-        fstab = open(self.build_dir + "/install_root/etc/fstab", "w")
-        fstab.write("/dev/mapper/livecd-rw   /                       ext3    defaults,noatime 0 0\n")
-        fstab.write("devpts                  /dev/pts                devpts  gid=5,mode=620  0 0\n")
-        fstab.write("tmpfs                   /dev/shm                tmpfs   defaults        0 0\n")
-        fstab.write("proc                    /proc                   proc    defaults        0 0\n")
-        fstab.write("sysfs                   /sys                    sysfs   defaults        0 0\n")
-        fstab.close()
+        pass
 
     def setup(self, image_size, base_on = None):
         """setup target ext3 file system in preparation for an install"""
@@ -377,15 +340,13 @@ class InstallationTarget:
         except OSError, (err, msg):
             raise InstallationError("Failed create build directory in /var/tmp: %s" % msg)
 
-        os.makedirs(self.build_dir + "/out/isolinux")
-        os.makedirs(self.build_dir + "/out/sysroot")
+        os.makedirs(self.build_dir + "/out")
         os.makedirs(self.build_dir + "/data/sysroot")
         os.makedirs(self.build_dir + "/install_root")
         os.makedirs(self.build_dir + "/yum-cache")
 
         if base_on:
-            # get backing ext3 image if we're based this build on an existing live CD ISO
-            self.base_on_iso(base_on)
+            self.base_on(base_on)
 
             self.instloop = LoopbackMount("%s/data/os.img" %(self.build_dir,),
                                           "%s/install_root" %(self.build_dir,))
@@ -748,6 +709,90 @@ class InstallationTarget:
 
         return kernels[0]
 
+    def relabelSystem(self):
+        # finally relabel all files
+        if self.ksparser.handler.selinux.selinux:
+            instroot = "%s/install_root" %(self.build_dir,)
+            if os.path.exists("%s/sbin/restorecon" %(instroot,)):
+                subprocess.call(["/sbin/restorecon", "-v", "-r", "/"],
+                                preexec_fn=self.run_in_root)
+
+    def prelinkSystem(self):
+        # prelink the system
+        if not self.skip_prelink:
+            instroot = "%s/install_root" %(self.build_dir,)
+            if os.path.exists("%s/usr/sbin/prelink" %(instroot,)):
+                subprocess.call(["/usr/sbin/prelink", "-mRaN"],
+                                preexec_fn=self.run_in_root)
+
+    def launchShell(self):
+        subprocess.call(["/bin/bash"], preexec_fn=self.run_in_root)
+
+    def install(self):
+        for (name, url) in self.repos:
+            self.ayum.addRepository(name, url)
+
+        self.installPackages(self.packages, self.epackages, self.groups)
+        self.configureSystem()
+        self.configureNetwork()
+        self.relabelSystem()
+        self.prelinkSystem()
+
+    def package(self):
+        pass
+
+class LiveCDTarget(InstallationTarget):
+    def __init__(self, repos, packages, epackages, groups, fs_label, skip_compression, skip_prelink):
+        InstallationTarget.__init__(self, repos, packages, epackages, groups, fs_label, skip_compression, skip_prelink)
+
+    def base_on(self, base_on):
+        """helper function to extract ext3 file system from a live CD ISO"""
+
+        isoloop = LoopbackMount(base_on, "%s/base_on_iso" %(self.build_dir,))
+
+        squashloop = LoopbackMount("%s/squashfs.img" %(isoloop.mountdir,),
+                                   "%s/base_on_squashfs" %(self.build_dir,),
+                                   "squashfs")
+
+        try:
+            try:
+                isoloop.mount()
+            except MountError, e:
+                raise InstallationError("Failed to loopback mount '%s' : %s" % (base_on, e))
+
+            if not os.path.exists(squashloop.lofile):
+                raise InstallationError("'%s' is not a valid live CD ISO : squashfs.img doesn't exist" % base_on)
+
+            try:
+                squashloop.mount()
+            except MountError, e:
+                raise InstallationError("Failed to loopback mount squashfs.img from '%s' : %s" % (base_on, e))
+
+            os_image = self.build_dir + "/base_on_squashfs/os.img"
+
+            if not os.path.exists(os_image):
+                raise InstallationError("'%s' is not a valid live CD ISO : os.img doesn't exist" % base_on)
+
+            shutil.copyfile(os_image, self.build_dir + "/data/os.img")
+        finally:
+            # unmount and tear down the mount points and loop devices used
+            squashloop.cleanup()
+            isoloop.cleanup()
+
+    def write_fstab(self):
+        fstab = open(self.build_dir + "/install_root/etc/fstab", "w")
+        fstab.write("/dev/mapper/livecd-rw   /                       ext3    defaults,noatime 0 0\n")
+        fstab.write("devpts                  /dev/pts                devpts  gid=5,mode=620  0 0\n")
+        fstab.write("tmpfs                   /dev/shm                tmpfs   defaults        0 0\n")
+        fstab.write("proc                    /proc                   proc    defaults        0 0\n")
+        fstab.write("sysfs                   /sys                    sysfs   defaults        0 0\n")
+        fstab.close()
+
+    def setup(self, image_size, base_on = None):
+        """setup target ext3 file system in preparation for an install"""
+        InstallationTarget.setup(self, image_size, base_on)
+        os.makedirs(self.build_dir + "/out/isolinux")
+
     def createInitramfs(self):
         # Create initramfs
         if not os.path.isfile("/usr/lib/livecd-creator/mayflower"):
@@ -770,25 +815,6 @@ class InstallationTarget:
         for f in ("/sbin/mayflower", "/etc/mayflower.conf"):
             os.unlink("%s/install_root/%s" %(self.build_dir, f))
 
-    def relabelSystem(self):
-        # finally relabel all files
-        if self.ksparser.handler.selinux.selinux:
-            instroot = "%s/install_root" %(self.build_dir,)
-            if os.path.exists("%s/sbin/restorecon" %(instroot,)):
-                subprocess.call(["/sbin/restorecon", "-v", "-r", "/"],
-                                preexec_fn=self.run_in_root)
-
-    def prelinkSystem(self):
-        # prelink the system
-        instroot = "%s/install_root" %(self.build_dir,)
-        if os.path.exists("%s/usr/sbin/prelink" %(instroot,)):
-            subprocess.call(["/usr/sbin/prelink", "-mRaN"],
-                            preexec_fn=self.run_in_root)
-        return True
-
-    def launchShell(self):
-        subprocess.call(["/bin/bash"], preexec_fn=self.run_in_root)
-
     def configureBootloader(self):
         """configure the boot loader"""
         
@@ -859,15 +885,7 @@ menu color hotkey 0 #ffffffff #ff000000
         # TODO: enable external entitity to partipate in adding boot entries
 
     def install(self):
-        for (name, url) in self.repos:
-            self.ayum.addRepository(name, url)
-
-        self.installPackages(self.packages, self.epackages, self.groups)
-        self.configureSystem()
-        self.configureNetwork()
-        self.relabelSystem()
-        if not self.skip_prelink:
-            self.prelinkSystem()
+        InstallationTarget.install(self)
         self.createInitramfs()
         self.configureBootloader()
 
@@ -900,6 +918,7 @@ menu color hotkey 0 #ffffffff #ff000000
                         "%s/out/ext3fs.img" %(self.build_dir,))
 
     def package(self):
+        InstallationTarget.package(self)
         self.createSquashFS()
         self.createIso()
 
@@ -1047,13 +1066,13 @@ def main():
         print >> sys.stderr, "You must run livecd-creator as root"
         return 1
 
-    target = InstallationTarget(options.repos,
-                                options.packages,
-                                options.epackages,
-                                options.groups,
-                                options.fs_label,
-                                options.skip_compression,
-                                options.skip_prelink)
+    target = LiveCDTarget(options.repos,
+                          options.packages,
+                          options.epackages,
+                          options.groups,
+                          options.fs_label,
+                          options.skip_compression,
+                          options.skip_prelink)
 
     try:
         target.parse(options.kscfg)
