Esempio n. 1
0
    def __init__(self, creatoropts=None, pkgmgr=None, compress_image=None, generate_bmap=None, fstab_entry="uuid"):
        """Initialize a ApplianceImageCreator instance.

            This method takes the same arguments as ImageCreator.__init__()
        """
        BaseImageCreator.__init__(self, creatoropts, pkgmgr)

        self.__instloop = None
        self.__imgdir = None
        self.__disks = {}
        self.__disk_format = "raw"
        self._disk_names = []
        self._ptable_format = self.ks.handler.bootloader.ptable
        self.vmem = 512
        self.vcpu = 1
        self.checksum = False
        self.use_uuid = fstab_entry == "uuid"
        self.appliance_version = None
        self.appliance_release = None
        self.compress_image = compress_image
        self.bmap_needed = generate_bmap
        #self.getsource = False
        #self.listpkg = False

        self._dep_checks.extend(["sync", "kpartx", "parted", "extlinux"])
Esempio n. 2
0
 def __init__(self, cfgmgr = None, pkgmgr = None):
     self.zips = { 
         "tar.bz2" : "" 
     }
     BaseImageCreator.__init__(self, cfgmgr, pkgmgr)
     self._fstype = None
     self._fsopts = None
     self._include_src = False
Esempio n. 3
0
    def configure(self, repodata = None):
        import subprocess
        def chroot():
            os.chroot(self._instroot)
            os.chdir("/")

        if os.path.exists(self._instroot + "/usr/bin/Xorg"):
            subprocess.call(["/bin/chmod", "u+s", "/usr/bin/Xorg"], preexec_fn = chroot)

        BaseImageCreator.configure(self, repodata)
Esempio n. 4
0
    def configure(self, repodata = None):
        import subprocess
        def chroot():
            os.chroot(self._instroot)
            os.chdir("/")

        if os.path.exists(self._instroot + "/usr/bin/Xorg"):
            subprocess.call(["/bin/chmod", "u+s", "/usr/bin/Xorg"],
                            preexec_fn = chroot)

        BaseImageCreator.configure(self, repodata)
Esempio n. 5
0
    def __init__(self, *args):
        """Initialize a ApplianceImageCreator instance.

            This method takes the same arguments as ImageCreator.__init__()
        """
        BaseImageCreator.__init__(self, *args)

        self.__instloop = None
        self.__imgdir = None
        self.__disks = {}
        self.__disk_format = "raw"
        self.vmem = 512
        self.vcpu = 1
        self.checksum = False
        self.appliance_version = None
        self.appliance_release = None
        #self.getsource = False
        #self.listpkg = False

        self._dep_checks.extend(["sync", "kpartx", "parted", "extlinux"])
Esempio n. 6
0
    def __init__(self, *args):
        """Initialize a ApplianceImageCreator instance.

            This method takes the same arguments as ImageCreator.__init__()
        """
        BaseImageCreator.__init__(self, *args)

        self.__instloop = None
        self.__imgdir = None
        self.__disks = {}
        self.__disk_format = "raw"
        self.vmem = 512
        self.vcpu = 1
        self.checksum = False
        self.appliance_version = None
        self.appliance_release = None
        #self.getsource = False
        #self.listpkg = False

        self._dep_checks.extend(["sync", "kpartx", "parted", "extlinux"])
Esempio n. 7
0
 def _get_excluded_packages(self):
     return BaseImageCreator._get_excluded_packages(self)
Esempio n. 8
0
 def _get_required_packages(self):
     required_packages = BaseImageCreator._get_required_packages(self)
     if not self.target_arch or not self.target_arch.startswith("arm"):
         required_packages += ["syslinux", "syslinux-extlinux"]
     return required_packages
Esempio n. 9
0
    def __init__(self, creatoropts=None, pkgmgr=None,
                 compress_image=None,
                 shrink_image=False):
        """Initialize a LoopImageCreator instance.

        This method takes the same arguments as ImageCreator.__init__()
        with the addition of:

        fslabel -- A string used as a label for any filesystems created.
        """

        BaseImageCreator.__init__(self, creatoropts, pkgmgr)

        self.compress_image = compress_image
        self.shrink_image = shrink_image

        self.__fslabel = None
        self.fslabel = self.name

        self.__blocksize = 4096
        if self.ks:
            self.__fstype = kickstart.get_image_fstype(self.ks,
                                                       "ext3")
            self.__fsopts = kickstart.get_image_fsopts(self.ks,
                                                       "defaults,noatime")

            allloops = []
            for part in sorted(kickstart.get_partitions(self.ks),
                               key=lambda p: p.mountpoint):
                if part.fstype == "swap":
                    continue

                label = part.label
                mp = part.mountpoint
                if mp == '/':
                    # the base image
                    if not label:
                        label = self.name
                else:
                    mp = mp.rstrip('/')
                    if not label:
                        msger.warning('no "label" specified for loop img at %s'
                                      ', use the mountpoint as the name' % mp)
                        label = mp.split('/')[-1]

                imgname = misc.strip_end(label, '.img') + '.img'
                allloops.append({
                    'mountpoint': mp,
                    'label': label,
                    'name': imgname,
                    'size': part.size or 4096L * 1024 * 1024,
                    'fstype': part.fstype or 'ext3',
                    'extopts': part.extopts or None,
                    'loop': None,  # to be created in _mount_instroot
                    })
            self._instloops = allloops

        else:
            self.__fstype = None
            self.__fsopts = None
            self._instloops = []

        self.__imgdir = None

        if self.ks:
            self.__image_size = kickstart.get_image_size(self.ks,
                                                         4096L * 1024 * 1024)
        else:
            self.__image_size = 0

        self._img_name = self.name + ".img"
Esempio n. 10
0
File: raw.py Progetto: lbt/mic
 def _get_excluded_packages(self):
     return BaseImageCreator._get_excluded_packages(self)
Esempio n. 11
0
File: raw.py Progetto: lbt/mic
 def _get_required_packages(self):
     required_packages = BaseImageCreator._get_required_packages(self)
     if not self.target_arch or not self.target_arch.startswith("arm"):
         required_packages += ["syslinux", "syslinux-extlinux"]
     return required_packages
Esempio n. 12
0
File: fs.py Progetto: xiaoqiang0/mic
 def __init__(self, cfgmgr = None, pkgmgr = None):
     self._valid_compression_methods = ["tar.bz2"]
     BaseImageCreator.__init__(self, cfgmgr, pkgmgr)
     self._fstype = None
     self._fsopts = None
     self._include_src = False
Esempio n. 13
0
    def __init__(self, creatoropts=None, pkgmgr=None,
                 compress_image=None,
                 shrink_image=False):
        """Initialize a LoopImageCreator instance.

        This method takes the same arguments as ImageCreator.__init__()
        with the addition of:

        fslabel -- A string used as a label for any filesystems created.
        """

        BaseImageCreator.__init__(self, creatoropts, pkgmgr)

        self.compress_image = compress_image
        self.shrink_image = shrink_image

        self.__fslabel = None
        self.fslabel = self.name

        self.__blocksize = 4096
        if self.ks:
            self.__fstype = kickstart.get_image_fstype(self.ks,
                                                       "ext3")
            self.__fsopts = kickstart.get_image_fsopts(self.ks,
                                                       "defaults,noatime")

            allloops = []
            for part in sorted(kickstart.get_partitions(self.ks),
                               key=lambda p: p.mountpoint):
                if part.fstype == "swap":
                    continue

                label = part.label
                mp = part.mountpoint
                if mp == '/':
                    # the base image
                    if not label:
                        label = self.name
                else:
                    mp = mp.rstrip('/')
                    if not label:
                        msger.warning('no "label" specified for loop img at %s'
                                      ', use the mountpoint as the name' % mp)
                        label = mp.split('/')[-1]

                imgname = misc.strip_end(label, '.img') + '.img'
                allloops.append({
                    'mountpoint': mp,
                    'label': label,
                    'name': imgname,
                    'size': part.size or 4096L * 1024 * 1024,
                    'fstype': part.fstype or 'ext3',
                    'loop': None,  # to be created in _mount_instroot
                    })
            self._instloops = allloops

        else:
            self.__fstype = None
            self.__fsopts = None
            self._instloops = []

        self.__imgdir = None

        if self.ks:
            self.__image_size = kickstart.get_image_size(self.ks,
                                                         4096L * 1024 * 1024)
        else:
            self.__image_size = 0

        self._img_name = self.name + ".img"
Esempio n. 14
0
 def __init__(self, cfgmgr=None, pkgmgr=None):
     self._valid_compression_methods = ["tar.bz2"]
     BaseImageCreator.__init__(self, cfgmgr, pkgmgr)
     self._fstype = None
     self._fsopts = None
     self._include_src = False