Drop MIC livecd image format support.
authorjianzhong.fang <jz.fang@samsung.com>
Thu, 17 Sep 2015 08:24:12 +0000 (16:24 +0800)
committeradmin <yuhuan.yang@samsung.com>
Thu, 4 Feb 2016 10:35:20 +0000 (18:35 +0800)
Change-Id: I22032747185fb6f2344c4a88ca227503d9369823

README.rst
doc/man.rst
doc/usage.rst
mic/imager/livecd.py [deleted file]
plugins/imager/livecd_plugin.py [deleted file]
tools/mic

index c3ff7bb..aa8d95a 100644 (file)
@@ -8,7 +8,7 @@ The tool offers three major functions:
 
 - image creation
 - image conversion bwtween two different formats
-- chrooting into an image
+- chrooting into an image 
 
 With the MIC tool, users can create different types of images for different
 verticals, including live CD images, live USB images, raw images for KVM,
@@ -35,7 +35,7 @@ Resource
 License
 -------
 MIC is Open Source and is distributed under the GPLv2 License.
-Please see the COPYING file included with this software
+Please see the COPYING file included with this software 
 
 
 Contacts
index c3cdc61..851cf1a 100644 (file)
@@ -31,7 +31,6 @@ Subcommands:
 
  | help(?)      give detailed help on a specific sub-command
  | fs           create fs image, which is also chroot directory
- | livecd       create live CD image, used for CD booting
  | loop         create loop image, including multi-partitions
  | raw          create raw image, containing multi-partitions
 
@@ -70,7 +69,6 @@ Options for raw image:
 Examples:
 
  | mic create loop tizen.ks
- | mic create livecd tizen.ks --release=latest
  | mic cr fs tizen.ks --local-pkgs-path=localrpm
 
 chroot
@@ -107,7 +105,7 @@ Options:
 
 Examples:
 
- | mic convert tizen.usbimg livecd
+
 
 Advanced Usage
 ==============
index f13f0a9..97cb701 100644 (file)
@@ -69,7 +69,6 @@ Create
 
   help(?)            give detailed help on a specific sub-command
   fs                 create fs image, which is also a chroot directory
-  livecd             create live CD image, used for CD booting
   loop               create loop image, including multi-partitions
   raw                create raw image, containing multi-partitions
 
diff --git a/mic/imager/livecd.py b/mic/imager/livecd.py
deleted file mode 100644 (file)
index febcd37..0000000
+++ /dev/null
@@ -1,758 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2011 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import os, sys
-import glob
-import shutil
-
-from mic import kickstart, msger
-from mic.utils import fs_related, rpmmisc, runner, misc
-from mic.utils.errors import CreatorError
-from mic.imager.loop import LoopImageCreator
-from mic.imager.baseimager import BaseImageCreator
-from mic.archive import packing
-
-
-class LiveImageCreatorBase(LoopImageCreator):
-    """A base class for LiveCD image creators.
-
-        This class serves as a base class for the architecture-specific LiveCD
-        image creator subclass, LiveImageCreator.
-
-        LiveImageCreator creates a bootable ISO containing the system image,
-        bootloader, bootloader configuration, kernel and initramfs.
-    """
-
-    img_format = 'livecd'
-
-    def __init__(self, creatoropts = None, pkgmgr = None):
-        """Initialise a LiveImageCreator instance.
-
-           This method takes the same arguments as ImageCreator.__init__().
-        """
-        LoopImageCreator.__init__(self, creatoropts, pkgmgr)
-
-        #Controls whether to use squashfs to compress the image.
-        self.skip_compression = False
-
-        #Controls whether an image minimizing snapshot should be created.
-        #
-        #This snapshot can be used when copying the system image from the ISO in
-        #order to minimize the amount of data that needs to be copied; simply,
-        #it makes it possible to create a version of the image's filesystem with
-        #no spare space.
-        self.skip_minimize = False
-
-        #A flag which indicates i act as a convertor default false
-        self.actasconvertor = False
-
-        #The bootloader timeout from kickstart.
-        if self.ks:
-            self._timeout = kickstart.get_timeout(self.ks, 10)
-        else:
-            self._timeout = 10
-
-        #The default kernel type from kickstart.
-        if self.ks:
-            self._default_kernel = kickstart.get_default_kernel(self.ks,
-                                                                "kernel")
-        else:
-            self._default_kernel = None
-
-        if self.ks:
-            parts = kickstart.get_partitions(self.ks)
-            if len(parts) > 1:
-                raise CreatorError("Can't support multi partitions in ks file "
-                                   "for this image type")
-            # FIXME: rename rootfs img to self.name,
-            # else can't find files when create iso
-            self._instloops[0]['name'] = self.name + ".img"
-
-        self.__isodir = None
-
-        self.__modules = ["=ata",
-                          "sym53c8xx",
-                          "aic7xxx",
-                          "=usb",
-                          "=firewire",
-                          "=mmc",
-                          "=pcmcia",
-                          "mptsas"]
-        if self.ks:
-            self.__modules.extend(kickstart.get_modules(self.ks))
-
-        self._dep_checks.extend(["isohybrid",
-                                 "unsquashfs",
-                                 "mksquashfs",
-                                 "dd",
-                                 "genisoimage"])
-
-    #
-    # Hooks for subclasses
-    #
-    def _configure_bootloader(self, isodir):
-        """Create the architecture specific booloader configuration.
-
-            This is the hook where subclasses must create the booloader
-            configuration in order to allow a bootable ISO to be built.
-
-            isodir -- the directory where the contents of the ISO are to
-                      be staged
-        """
-        raise CreatorError("Bootloader configuration is arch-specific, "
-                           "but not implemented for this arch!")
-    def _get_menu_options(self):
-        """Return a menu options string for syslinux configuration.
-        """
-        if self.ks is None:
-            return "liveinst autoinst"
-        r = kickstart.get_menu_args(self.ks)
-        return r
-
-    def _get_kernel_options(self):
-        """Return a kernel options string for bootloader configuration.
-
-            This is the hook where subclasses may specify a set of kernel
-            options which should be included in the images bootloader
-            configuration.
-
-            A sensible default implementation is provided.
-        """
-
-        if self.ks is None:
-            r = "ro rd.live.image"
-        else:
-            r = kickstart.get_kernel_args(self.ks)
-
-        return r
-
-    def _get_mkisofs_options(self, isodir):
-        """Return the architecture specific mkisosfs options.
-
-            This is the hook where subclasses may specify additional arguments
-            to mkisofs, e.g. to enable a bootable ISO to be built.
-
-            By default, an empty list is returned.
-        """
-        return []
-
-    #
-    # Helpers for subclasses
-    #
-    def _has_checkisomd5(self):
-        """Check whether checkisomd5 is available in the install root."""
-        def _exists(path):
-            return os.path.exists(self._instroot + path)
-
-        if _exists("/usr/bin/checkisomd5") and os.path.exists("/usr/bin/implantisomd5"):
-            return True
-
-        return False
-
-    def __restore_file(self,path):
-        try:
-            os.unlink(path)
-        except:
-            pass
-        if os.path.exists(path + '.rpmnew'):
-            os.rename(path + '.rpmnew', path)
-
-    def _mount_instroot(self, base_on = None):
-        LoopImageCreator._mount_instroot(self, base_on)
-        self.__write_initrd_conf(self._instroot + "/etc/sysconfig/mkinitrd")
-        self.__write_dracut_conf(self._instroot + "/etc/dracut.conf.d/02livecd.conf")
-
-    def _unmount_instroot(self):
-        self.__restore_file(self._instroot + "/etc/sysconfig/mkinitrd")
-        self.__restore_file(self._instroot + "/etc/dracut.conf.d/02livecd.conf")
-        LoopImageCreator._unmount_instroot(self)
-
-    def __ensure_isodir(self):
-        if self.__isodir is None:
-            self.__isodir = self._mkdtemp("iso-")
-        return self.__isodir
-
-    def _get_isodir(self):
-        return self.__ensure_isodir()
-
-    def _set_isodir(self, isodir = None):
-        self.__isodir = isodir
-
-    def _create_bootconfig(self):
-        """Configure the image so that it's bootable."""
-        self._configure_bootloader(self.__ensure_isodir())
-
-    def _get_post_scripts_env(self, in_chroot):
-        env = LoopImageCreator._get_post_scripts_env(self, in_chroot)
-
-        if not in_chroot:
-            env["LIVE_ROOT"] = self.__ensure_isodir()
-
-        return env
-    def __write_dracut_conf(self, path):
-        if not os.path.exists(os.path.dirname(path)):
-            fs_related.makedirs(os.path.dirname(path))
-        f = open(path, "a")
-        f.write('add_dracutmodules+=" dmsquash-live pollcdrom "')
-        f.close()
-
-    def __write_initrd_conf(self, path):
-        content = ""
-        if not os.path.exists(os.path.dirname(path)):
-            fs_related.makedirs(os.path.dirname(path))
-        f = open(path, "w")
-
-        content += 'LIVEOS="yes"\n'
-        content += 'PROBE="no"\n'
-        content += 'MODULES+="squashfs ext3 ext2 vfat msdos "\n'
-        content += 'MODULES+="sr_mod sd_mod ide-cd cdrom "\n'
-
-        for module in self.__modules:
-            if module == "=usb":
-                content += 'MODULES+="ehci_hcd uhci_hcd ohci_hcd "\n'
-                content += 'MODULES+="usb_storage usbhid "\n'
-            elif module == "=firewire":
-                content += 'MODULES+="firewire-sbp2 firewire-ohci "\n'
-                content += 'MODULES+="sbp2 ohci1394 ieee1394 "\n'
-            elif module == "=mmc":
-                content += 'MODULES+="mmc_block sdhci sdhci-pci "\n'
-            elif module == "=pcmcia":
-                content += 'MODULES+="pata_pcmcia  "\n'
-            else:
-                content += 'MODULES+="' + module + ' "\n'
-        f.write(content)
-        f.close()
-
-    def __create_iso(self, isodir):
-        iso = self._outdir + "/" + self.name + ".iso"
-        genisoimage = fs_related.find_binary_path("genisoimage")
-        args = [genisoimage,
-                "-J", "-r",
-                "-hide-rr-moved", "-hide-joliet-trans-tbl",
-                "-V", self.fslabel,
-                "-o", iso]
-
-        args.extend(self._get_mkisofs_options(isodir))
-
-        args.append(isodir)
-
-        if runner.show(args) != 0:
-            raise CreatorError("ISO creation failed!")
-
-        """ It should be ok still even if you haven't isohybrid """
-        isohybrid = None
-        try:
-            isohybrid = fs_related.find_binary_path("isohybrid")
-        except:
-            pass
-
-        if isohybrid:
-            args = [isohybrid, "-partok", iso ]
-            if runner.show(args) != 0:
-                raise CreatorError("Hybrid ISO creation failed!")
-
-        self.__implant_md5sum(iso)
-
-    def __implant_md5sum(self, iso):
-        """Implant an isomd5sum."""
-        if os.path.exists("/usr/bin/implantisomd5"):
-            implantisomd5 = "/usr/bin/implantisomd5"
-        else:
-            msger.warning("isomd5sum not installed; not setting up mediacheck")
-            implantisomd5 = ""
-            return
-
-        runner.show([implantisomd5, iso])
-
-    def _stage_final_image(self):
-        try:
-            fs_related.makedirs(self.__ensure_isodir() + "/LiveOS")
-
-            minimal_size = self._resparse()
-
-            if not self.skip_minimize:
-                fs_related.create_image_minimizer(self.__isodir + \
-                                                      "/LiveOS/osmin.img",
-                                                  self._image,
-                                                  minimal_size)
-
-            if self.skip_compression:
-                shutil.move(self._image, self.__isodir + "/LiveOS/ext3fs.img")
-            else:
-                fs_related.makedirs(os.path.join(
-                                        os.path.dirname(self._image),
-                                        "LiveOS"))
-                shutil.move(self._image,
-                            os.path.join(os.path.dirname(self._image),
-                                         "LiveOS", "ext3fs.img"))
-                fs_related.mksquashfs(os.path.dirname(self._image),
-                           self.__isodir + "/LiveOS/squashfs.img")
-
-            self.__create_iso(self.__isodir)
-
-            if self.pack_to:
-                isoimg = os.path.join(self._outdir, self.name + ".iso")
-                packimg = os.path.join(self._outdir, self.pack_to)
-                packing(packimg, isoimg)
-                os.unlink(isoimg)
-                self.image_files.update({'image_files': [self.pack_to]})
-            else:
-                self.image_files.update({'image_files': [self.name + ".iso"]})
-
-        finally:
-            shutil.rmtree(self.__isodir, ignore_errors = True)
-            self.__isodir = None
-
-
-class x86LiveImageCreator(LiveImageCreatorBase):
-    """ImageCreator for x86 machines"""
-    def _get_mkisofs_options(self, isodir):
-        return [ "-b", "isolinux/isolinux.bin",
-                 "-c", "isolinux/boot.cat",
-                 "-no-emul-boot", "-boot-info-table",
-                 "-boot-load-size", "4" ]
-
-    def _get_required_packages(self):
-        return ["syslinux", "syslinux-extlinux"] + \
-               LiveImageCreatorBase._get_required_packages(self)
-
-    def _get_isolinux_stanzas(self, isodir):
-        return ""
-
-    def __find_syslinux_menu(self):
-        for menu in ["vesamenu.c32", "menu.c32"]:
-            if os.path.isfile(self._instroot + "/usr/share/syslinux/" + menu):
-                return menu
-
-        raise CreatorError("syslinux not installed : "
-                           "no suitable /usr/share/syslinux/*menu.c32 found")
-
-    def __find_syslinux_mboot(self):
-        #
-        # We only need the mboot module if we have any xen hypervisors
-        #
-        if not glob.glob(self._instroot + "/boot/xen.gz*"):
-            return None
-
-        return "mboot.c32"
-
-    def __copy_syslinux_files(self, isodir, menu, mboot = None):
-        files = ["isolinux.bin", menu]
-        if mboot:
-            files += [mboot]
-
-        for f in files:
-            path = self._instroot + "/usr/share/syslinux/" + f
-
-            if not os.path.isfile(path):
-                raise CreatorError("syslinux not installed : "
-                                   "%s not found" % path)
-
-            shutil.copy(path, isodir + "/isolinux/")
-
-    def __copy_syslinux_background(self, isodest):
-        background_path = self._instroot + \
-                          "/usr/share/branding/default/syslinux/syslinux-vesa-splash.jpg"
-
-        if not os.path.exists(background_path):
-            return False
-
-        shutil.copyfile(background_path, isodest)
-
-        return True
-
-    def __copy_kernel_and_initramfs(self, isodir, version, index):
-        bootdir = self._instroot + "/boot"
-        isDracut = False
-
-        if self._alt_initrd_name:
-            src_initrd_path = os.path.join(bootdir, self._alt_initrd_name)
-        else:
-            if os.path.exists(bootdir + "/initramfs-" + version + ".img"):
-                src_initrd_path = os.path.join(bootdir, "initramfs-" +version+ ".img")
-                isDracut = True
-            else:
-                src_initrd_path = os.path.join(bootdir, "initrd-" +version+ ".img")
-
-        try:
-            msger.debug("copy %s to %s" % (bootdir + "/vmlinuz-" + version, isodir + "/isolinux/vmlinuz" + index))
-            shutil.copyfile(bootdir + "/vmlinuz-" + version,
-                    isodir + "/isolinux/vmlinuz" + index)
-
-            msger.debug("copy %s to %s" % (src_initrd_path, isodir + "/isolinux/initrd" + index + ".img"))
-            shutil.copyfile(src_initrd_path,
-                            isodir + "/isolinux/initrd" + index + ".img")
-        except:
-            raise CreatorError("Unable to copy valid kernels or initrds, "
-                               "please check the repo.")
-
-        is_xen = False
-        if os.path.exists(bootdir + "/xen.gz-" + version[:-3]):
-            shutil.copyfile(bootdir + "/xen.gz-" + version[:-3],
-                            isodir + "/isolinux/xen" + index + ".gz")
-            is_xen = True
-
-        return (is_xen,isDracut)
-
-    def __is_default_kernel(self, kernel, kernels):
-        if len(kernels) == 1:
-            return True
-
-        if kernel == self._default_kernel:
-            return True
-
-        if kernel.startswith("kernel-") and kernel[7:] == self._default_kernel:
-            return True
-
-        return False
-
-    def __get_basic_syslinux_config(self, **args):
-        return """
-default %(menu)s
-timeout %(timeout)d
-
-%(background)s
-menu title Welcome to %(distroname)s!
-menu color border 0 #ffffffff #00000000
-menu color sel 7 #ff000000 #ffffffff
-menu color title 0 #ffffffff #00000000
-menu color tabmsg 0 #ffffffff #00000000
-menu color unsel 0 #ffffffff #00000000
-menu color hotsel 0 #ff000000 #ffffffff
-menu color hotkey 7 #ffffffff #ff000000
-menu color timeout_msg 0 #ffffffff #00000000
-menu color timeout 0 #ffffffff #00000000
-menu color cmdline 0 #ffffffff #00000000
-menu hidden
-menu clear
-""" % args
-
-    def __get_image_stanza(self, is_xen, isDracut, **args):
-        if isDracut:
-            args["rootlabel"] = "live:CDLABEL=%(fslabel)s" % args
-        else:
-            args["rootlabel"] = "CDLABEL=%(fslabel)s" % args
-        if not is_xen:
-            template = """label %(short)s
-  menu label %(long)s
-  kernel vmlinuz%(index)s
-  append initrd=initrd%(index)s.img root=%(rootlabel)s rootfstype=iso9660 %(liveargs)s %(extra)s
-"""
-        else:
-            template = """label %(short)s
-  menu label %(long)s
-  kernel mboot.c32
-  append xen%(index)s.gz --- vmlinuz%(index)s root=%(rootlabel)s rootfstype=iso9660 %(liveargs)s %(extra)s --- initrd%(index)s.img
-"""
-        return template % args
-
-    def __get_image_stanzas(self, isodir):
-        versions = []
-        kernels = self._get_kernel_versions()
-        for kernel in kernels:
-            for version in kernels[kernel]:
-                versions.append(version)
-
-        if not versions:
-            raise CreatorError("Unable to find valid kernels, "
-                               "please check the repo")
-
-        kernel_options = self._get_kernel_options()
-
-        """ menu can be customized highly, the format is:
-
-          short_name1:long_name1:extra_opts1;short_name2:long_name2:extra_opts2
-
-        e.g.: autoinst:InstallationOnly:systemd.unit=installer-graphical.service
-        but in order to keep compatible with old format, these are still ok:
-
-              liveinst autoinst
-              liveinst;autoinst
-              liveinst::;autoinst::
-        """
-        oldmenus = {"basic": {
-                        "short": "basic",
-                        "long": "Installation Only (Text based)",
-                        "extra": "basic nosplash 4"
-                    },
-                    "liveinst": {
-                        "short": "liveinst",
-                        "long": "Installation Only",
-                        "extra": "liveinst nosplash 4"
-                    },
-                    "autoinst": {
-                        "short": "autoinst",
-                        "long": "Autoinstall (Deletes all existing content)",
-                        "extra": "autoinst nosplash 4"
-                    },
-                    "netinst": {
-                        "short": "netinst",
-                        "long": "Network Installation",
-                        "extra": "netinst 4"
-                    },
-                    "verify": {
-                        "short": "check",
-                        "long": "Verify and",
-                        "extra": "check"
-                    }
-                   }
-        menu_options = self._get_menu_options()
-        menus = menu_options.split(";")
-        for i in range(len(menus)):
-            menus[i] = menus[i].split(":")
-        if len(menus) == 1 and len(menus[0]) == 1:
-            """ Keep compatible with the old usage way """
-            menus = menu_options.split()
-            for i in range(len(menus)):
-                menus[i] = [menus[i]]
-
-        cfg = ""
-
-        default_version = None
-        default_index = None
-        index = "0"
-        netinst = None
-        for version in versions:
-            (is_xen, isDracut) = self.__copy_kernel_and_initramfs(isodir, version, index)
-            if index == "0":
-                self._isDracut = isDracut
-
-            default = self.__is_default_kernel(kernel, kernels)
-
-            if default:
-                long = "Boot %s" % self.distro_name
-            elif kernel.startswith("kernel-"):
-                long = "Boot %s(%s)" % (self.name, kernel[7:])
-            else:
-                long = "Boot %s(%s)" % (self.name, kernel)
-
-            oldmenus["verify"]["long"] = "%s %s" % (oldmenus["verify"]["long"],
-                                                    long)
-            # tell dracut not to ask for LUKS passwords or activate mdraid sets
-            if isDracut:
-                kern_opts = kernel_options + " rd.luks=0 rd.md=0 rd.dm=0"
-            else:
-                kern_opts = kernel_options
-
-            cfg += self.__get_image_stanza(is_xen, isDracut,
-                                           fslabel = self.fslabel,
-                                           liveargs = kern_opts,
-                                           long = long,
-                                           short = "linux" + index,
-                                           extra = "",
-                                           index = index)
-
-            if default:
-                cfg += "menu default\n"
-                default_version = version
-                default_index = index
-
-            for menu in menus:
-                if not menu[0]:
-                    continue
-                short = menu[0] + index
-
-                if len(menu) >= 2:
-                    long = menu[1]
-                else:
-                    if menu[0] in oldmenus.keys():
-                        if menu[0] == "verify" and not self._has_checkisomd5():
-                            continue
-                        if menu[0] == "netinst":
-                            netinst = oldmenus[menu[0]]
-                            continue
-                        long = oldmenus[menu[0]]["long"]
-                        extra = oldmenus[menu[0]]["extra"]
-                    else:
-                        long = short.upper() + " X" + index
-                        extra = ""
-
-                if len(menu) >= 3:
-                    extra = ' '.join(menu[2:])
-
-                cfg += self.__get_image_stanza(is_xen, isDracut,
-                                               fslabel = self.fslabel,
-                                               liveargs = kernel_options,
-                                               long = long,
-                                               short = short,
-                                               extra = extra,
-                                               index = index)
-
-            index = str(int(index) + 1)
-
-        if not default_version:
-            default_version = versions[0]
-        if not default_index:
-            default_index = "0"
-
-        if netinst:
-            cfg += self.__get_image_stanza(is_xen, isDracut,
-                                           fslabel = self.fslabel,
-                                           liveargs = kernel_options,
-                                           long = netinst["long"],
-                                           short = netinst["short"],
-                                           extra = netinst["extra"],
-                                           index = default_index)
-
-        return cfg
-
-    def __get_memtest_stanza(self, isodir):
-        memtest = glob.glob(self._instroot + "/boot/memtest86*")
-        if not memtest:
-            return ""
-
-        shutil.copyfile(memtest[0], isodir + "/isolinux/memtest")
-
-        return """label memtest
-  menu label Memory Test
-  kernel memtest
-"""
-
-    def __get_local_stanza(self, isodir):
-        return """label local
-  menu label Boot from local drive
-  localboot 0xffff
-"""
-
-    def _configure_syslinux_bootloader(self, isodir):
-        """configure the boot loader"""
-        fs_related.makedirs(isodir + "/isolinux")
-
-        menu = self.__find_syslinux_menu()
-
-        self.__copy_syslinux_files(isodir, menu,
-                                   self.__find_syslinux_mboot())
-
-        background = ""
-        if self.__copy_syslinux_background(isodir + "/isolinux/splash.jpg"):
-            background = "menu background splash.jpg"
-
-        cfg = self.__get_basic_syslinux_config(menu = menu,
-                                               background = background,
-                                               name = self.name,
-                                               timeout = self._timeout * 10,
-                                               distroname = self.distro_name)
-
-        cfg += self.__get_image_stanzas(isodir)
-        cfg += self.__get_memtest_stanza(isodir)
-        cfg += self.__get_local_stanza(isodir)
-        cfg += self._get_isolinux_stanzas(isodir)
-
-        cfgf = open(isodir + "/isolinux/isolinux.cfg", "w")
-        cfgf.write(cfg)
-        cfgf.close()
-
-    def __copy_efi_files(self, isodir):
-        if not os.path.exists(self._instroot + "/boot/efi/EFI/redhat/grub.efi"):
-            return False
-        shutil.copy(self._instroot + "/boot/efi/EFI/redhat/grub.efi",
-                    isodir + "/EFI/boot/grub.efi")
-        shutil.copy(self._instroot + "/boot/grub/splash.xpm.gz",
-                    isodir + "/EFI/boot/splash.xpm.gz")
-
-        return True
-
-    def __get_basic_efi_config(self, **args):
-        return """
-default=0
-splashimage=/EFI/boot/splash.xpm.gz
-timeout %(timeout)d
-hiddenmenu
-
-""" %args
-
-    def __get_efi_image_stanza(self, **args):
-        return """title %(long)s
-  kernel /EFI/boot/vmlinuz%(index)s root=CDLABEL=%(fslabel)s rootfstype=iso9660 %(liveargs)s %(extra)s
-  initrd /EFI/boot/initrd%(index)s.img
-""" %args
-
-    def __get_efi_image_stanzas(self, isodir, name):
-        # FIXME: this only supports one kernel right now...
-
-        kernel_options = self._get_kernel_options()
-        checkisomd5 = self._has_checkisomd5()
-
-        cfg = ""
-
-        for index in range(0, 9):
-            # we don't support xen kernels
-            if os.path.exists("%s/EFI/boot/xen%d.gz" %(isodir, index)):
-                continue
-            cfg += self.__get_efi_image_stanza(fslabel = self.fslabel,
-                                               liveargs = kernel_options,
-                                               long = name,
-                                               extra = "", index = index)
-            if checkisomd5:
-                cfg += self.__get_efi_image_stanza(
-                                               fslabel = self.fslabel,
-                                               liveargs = kernel_options,
-                                               long = "Verify and Boot " + name,
-                                               extra = "check",
-                                               index = index)
-            break
-
-        return cfg
-
-    def _configure_efi_bootloader(self, isodir):
-        """Set up the configuration for an EFI bootloader"""
-        fs_related.makedirs(isodir + "/EFI/boot")
-
-        if not self.__copy_efi_files(isodir):
-            shutil.rmtree(isodir + "/EFI")
-            return
-
-        for f in os.listdir(isodir + "/isolinux"):
-            os.link("%s/isolinux/%s" %(isodir, f),
-                    "%s/EFI/boot/%s" %(isodir, f))
-
-
-        cfg = self.__get_basic_efi_config(name = self.name,
-                                          timeout = self._timeout)
-        cfg += self.__get_efi_image_stanzas(isodir, self.name)
-
-        cfgf = open(isodir + "/EFI/boot/grub.conf", "w")
-        cfgf.write(cfg)
-        cfgf.close()
-
-        # first gen mactel machines get the bootloader name wrong apparently
-        if rpmmisc.getBaseArch() == "i386":
-            os.link(isodir + "/EFI/boot/grub.efi",
-                    isodir + "/EFI/boot/boot.efi")
-            os.link(isodir + "/EFI/boot/grub.conf",
-                    isodir + "/EFI/boot/boot.conf")
-
-        # for most things, we want them named boot$efiarch
-        efiarch = {"i386": "ia32", "x86_64": "x64"}
-        efiname = efiarch[rpmmisc.getBaseArch()]
-        os.rename(isodir + "/EFI/boot/grub.efi",
-                  isodir + "/EFI/boot/boot%s.efi" %(efiname,))
-        os.link(isodir + "/EFI/boot/grub.conf",
-                isodir + "/EFI/boot/boot%s.conf" %(efiname,))
-
-
-    def _configure_bootloader(self, isodir):
-        self._configure_syslinux_bootloader(isodir)
-        self._configure_efi_bootloader(isodir)
-
-arch = rpmmisc.getBaseArch()
-if arch in ("i386", "x86_64"):
-    LiveCDImageCreator = x86LiveImageCreator
-elif arch.startswith("arm"):
-    LiveCDImageCreator = LiveImageCreatorBase
-else:
-    raise CreatorError("Architecture not supported!")
diff --git a/plugins/imager/livecd_plugin.py b/plugins/imager/livecd_plugin.py
deleted file mode 100644 (file)
index b4291b1..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-#!/usr/bin/python -tt
-#
-# Copyright (c) 2011 Intel, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the Free
-# Software Foundation; version 2 of the License
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc., 59
-# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import os
-import shutil
-import tempfile
-
-from mic import chroot, msger, rt_util
-from mic.utils import misc, fs_related, errors
-from mic.conf import configmgr
-import mic.imager.livecd as livecd
-from mic.plugin import pluginmgr
-
-from mic.pluginbase import ImagerPlugin
-class LiveCDPlugin(ImagerPlugin):
-    name = 'livecd'
-
-    @classmethod
-    def do_create(self, subcmd, opts, *args):
-        """${cmd_name}: create livecd image
-
-        Usage:
-            ${name} ${cmd_name} <ksfile> [OPTS]
-
-        ${cmd_option_list}
-        """
-
-        if len(args) != 1:
-            raise errors.Usage("Extra arguments given")
-
-        creatoropts = configmgr.create
-        ksconf = args[0]
-
-        if creatoropts['runtime'] == 'bootstrap':
-            configmgr._ksconf = ksconf
-            rt_util.bootstrap_mic()
-
-        if creatoropts['arch'] and creatoropts['arch'].startswith('arm'):
-            msger.warning('livecd cannot support arm images, Quit')
-            return
-
-        recording_pkgs = []
-        if len(creatoropts['record_pkgs']) > 0:
-            recording_pkgs = creatoropts['record_pkgs']
-
-        if creatoropts['release'] is not None:
-            if 'name' not in recording_pkgs:
-                recording_pkgs.append('name')
-            if 'vcs' not in recording_pkgs:
-                recording_pkgs.append('vcs')
-
-        configmgr._ksconf = ksconf
-
-        # try to find the pkgmgr
-        pkgmgr = None
-        backends = pluginmgr.get_plugins('backend')
-        if 'auto' == creatoropts['pkgmgr']:
-            for key in configmgr.prefer_backends:
-                if key in backends:
-                    pkgmgr = backends[key]
-                    break
-        else:
-            for key in backends.keys():
-                if key == creatoropts['pkgmgr']:
-                    pkgmgr = backends[key]
-                    break
-
-        if not pkgmgr:
-            raise errors.CreatorError("Can't find backend: %s, "
-                                      "available choices: %s" %
-                                      (creatoropts['pkgmgr'],
-                                       ','.join(backends.keys())))
-
-        creator = livecd.LiveCDImageCreator(creatoropts, pkgmgr)
-
-        if len(recording_pkgs) > 0:
-            creator._recording_pkgs = recording_pkgs
-
-        self.check_image_exists(creator.destdir,
-                                creator.pack_to,
-                                [creator.name + ".iso"],
-                                creatoropts['release'])
-
-        try:
-            creator.check_depend_tools()
-            creator.mount(None, creatoropts["cachedir"])
-            creator.install()
-            creator.configure(creatoropts["repomd"])
-            creator.copy_kernel()
-            creator.unmount()
-            creator.package(creatoropts["destdir"])
-            creator.create_manifest()
-            if creatoropts['release'] is not None:
-                creator.release_output(ksconf, creatoropts['destdir'], creatoropts['release'])
-            creator.print_outimage_info()
-
-        except errors.CreatorError:
-            raise
-        finally:
-            creator.cleanup()
-
-        msger.info("Finished.")
-        return 0
-
-    @classmethod
-    def do_chroot(cls, target, cmd=[]):
-        os_image = cls.do_unpack(target)
-        os_image_dir = os.path.dirname(os_image)
-
-        # unpack image to target dir
-        imgsize = misc.get_file_size(os_image) * 1024L * 1024L
-        imgtype = misc.get_image_type(os_image)
-        if imgtype == "btrfsimg":
-            fstype = "btrfs"
-            myDiskMount = fs_related.BtrfsDiskMount
-        elif imgtype in ("ext3fsimg", "ext4fsimg"):
-            fstype = imgtype[:4]
-            myDiskMount = fs_related.ExtDiskMount
-        else:
-            raise errors.CreatorError("Unsupported filesystem type: %s" % fstype)
-
-        extmnt = misc.mkdtemp()
-        extloop = myDiskMount(fs_related.SparseLoopbackDisk(os_image, imgsize),
-                              extmnt,
-                              fstype,
-                              4096,
-                              "%s label" % fstype)
-        try:
-            extloop.mount()
-
-        except errors.MountError:
-            extloop.cleanup()
-            shutil.rmtree(extmnt, ignore_errors = True)
-            shutil.rmtree(os_image_dir, ignore_errors = True)
-            raise
-
-        try:
-            if len(cmd) != 0:
-                cmdline = ' '.join(cmd)
-            else:
-                cmdline = "/bin/bash"
-            envcmd = fs_related.find_binary_inchroot("env", extmnt)
-            if envcmd:
-                cmdline = "%s HOME=/root %s" % (envcmd, cmdline)
-            chroot.chroot(extmnt, None, cmdline)
-        except:
-            raise errors.CreatorError("Failed to chroot to %s." %target)
-        finally:
-            chroot.cleanup_after_chroot("img", extloop, os_image_dir, extmnt)
-
-    @classmethod
-    def do_pack(cls, base_on):
-        import subprocess
-
-        def __mkinitrd(instance):
-            kernelver = instance._get_kernel_versions().values()[0][0]
-            args = [ "/usr/libexec/mkliveinitrd", "/boot/initrd-%s.img" % kernelver, "%s" % kernelver ]
-            try:
-                subprocess.call(args, preexec_fn = instance._chroot)
-            except OSError, (err, msg):
-                raise errors.CreatorError("Failed to execute /usr/libexec/mkliveinitrd: %s" % msg)
-
-        def __run_post_cleanups(instance):
-            kernelver = instance._get_kernel_versions().values()[0][0]
-            args = ["rm", "-f", "/boot/initrd-%s.img" % kernelver]
-
-            try:
-                subprocess.call(args, preexec_fn = instance._chroot)
-            except OSError, (err, msg):
-                raise errors.CreatorError("Failed to run post cleanups: %s" % msg)
-
-        convertoropts = configmgr.convert
-        convertoropts['name'] = os.path.splitext(os.path.basename(base_on))[0]
-        convertor = livecd.LiveCDImageCreator(convertoropts)
-        imgtype = misc.get_image_type(base_on)
-        if imgtype == "btrfsimg":
-            fstype = "btrfs"
-        elif imgtype in ("ext3fsimg", "ext4fsimg"):
-            fstype = imgtype[:4]
-        else:
-            raise errors.CreatorError("Unsupported filesystem type: %s" % fstype)
-        convertor._set_fstype(fstype)
-        try:
-            convertor.mount(base_on)
-            __mkinitrd(convertor)
-            convertor._create_bootconfig()
-            __run_post_cleanups(convertor)
-            convertor.launch_shell(convertoropts['shell'])
-            convertor.unmount()
-            convertor.package()
-            convertor.print_outimage_info()
-        finally:
-            shutil.rmtree(os.path.dirname(base_on), ignore_errors = True)
-
-    @classmethod
-    def do_unpack(cls, srcimg):
-        img = srcimg
-        imgmnt = misc.mkdtemp()
-        imgloop = fs_related.DiskMount(fs_related.LoopbackDisk(img, 0), imgmnt)
-        try:
-            imgloop.mount()
-        except errors.MountError:
-            imgloop.cleanup()
-            raise
-
-        # legacy LiveOS filesystem layout support, remove for F9 or F10
-        if os.path.exists(imgmnt + "/squashfs.img"):
-            squashimg = imgmnt + "/squashfs.img"
-        else:
-            squashimg = imgmnt + "/LiveOS/squashfs.img"
-
-        tmpoutdir = misc.mkdtemp()
-        # unsquashfs requires outdir mustn't exist
-        shutil.rmtree(tmpoutdir, ignore_errors = True)
-        misc.uncompress_squashfs(squashimg, tmpoutdir)
-
-        try:
-            # legacy LiveOS filesystem layout support, remove for F9 or F10
-            if os.path.exists(tmpoutdir + "/os.img"):
-                os_image = tmpoutdir + "/os.img"
-            else:
-                os_image = tmpoutdir + "/LiveOS/ext3fs.img"
-
-            if not os.path.exists(os_image):
-                raise errors.CreatorError("'%s' is not a valid live CD ISO : neither "
-                                          "LiveOS/ext3fs.img nor os.img exist" %img)
-
-            imgname = os.path.basename(srcimg)
-            imgname = os.path.splitext(imgname)[0] + ".img"
-            rtimage = os.path.join(tempfile.mkdtemp(dir = "/var/tmp", prefix = "tmp"), imgname)
-            shutil.copyfile(os_image, rtimage)
-
-        finally:
-            imgloop.cleanup()
-            shutil.rmtree(tmpoutdir, ignore_errors = True)
-            shutil.rmtree(imgmnt, ignore_errors = True)
-
-        return rtimage
index 9dcc5bf..871f9bd 100755 (executable)
--- a/tools/mic
+++ b/tools/mic
@@ -173,7 +173,6 @@ class MicCmd(cmdln.Cmdln):
             raise errors.CreatorError("Can't convert from %s to %s" \
                                   % (srcformat, destformat))
         maptab = {
-                    "livecd": "iso",
                     "loop": "img",
                  }
         if destformat in maptab: