示例#1
0
文件: livecd.py 项目: sledges/mic
    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"])
示例#2
0
    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


        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"])
示例#3
0
    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
示例#4
0
    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
示例#5
0
 def _unmount_instroot(self):
     try:
         os.unlink(self._instroot + "/etc/sysconfig/mkinitrd")
     except:
         pass
     LoopImageCreator._unmount_instroot(self)
示例#6
0
 def _mount_instroot(self, base_on = None):
     LoopImageCreator._mount_instroot(self, base_on)
     self.__write_initrd_conf(self._instroot + "/etc/sysconfig/mkinitrd")
示例#7
0
 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)
示例#8
0
 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")
示例#9
0
 def _unmount_instroot(self):
     try:
         os.unlink(self._instroot + "/etc/sysconfig/mkinitrd")
     except:
         pass
     LoopImageCreator._unmount_instroot(self)
示例#10
0
 def _mount_instroot(self, base_on = None):
     LoopImageCreator._mount_instroot(self, base_on)
     self.__write_initrd_conf(self._instroot + "/etc/sysconfig/mkinitrd")