diff options
-rw-r--r-- | mic/imager/baseimager.py | 5 | ||||
-rw-r--r-- | mic/imager/livecd.py | 3 | ||||
-rw-r--r-- | mic/imager/liveusb.py | 4 | ||||
-rw-r--r-- | mic/imager/loop.py | 5 | ||||
-rw-r--r-- | mic/imager/raw.py | 6 |
5 files changed, 13 insertions, 10 deletions
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index 045da22..269d653 100644 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -36,6 +36,7 @@ from mic import msger, __version__ as VERSION from mic.utils.errors import CreatorError, Abort from mic.utils import misc, grabber, runner, fs_related as fs from mic.chroot import kill_proc_inchroot +from mic.archive import get_archive_suffixes class BaseImageCreator(object): """Installs a system to a chroot directory. @@ -116,9 +117,9 @@ class BaseImageCreator(object): if '@NAME@' in self.pack_to: self.pack_to = self.pack_to.replace('@NAME@', self.name) (tar, ext) = os.path.splitext(self.pack_to) - if ext in (".gz", ".bz2") and tar.endswith(".tar"): + if ext in (".gz", ".bz2", ".lzo", ".bz") and tar.endswith(".tar"): ext = ".tar" + ext - if ext not in misc.pack_formats: + if ext not in get_archive_suffixes(): self.pack_to += ".tar" self._dep_checks = ["ls", "bash", "cp", "echo", "modprobe"] diff --git a/mic/imager/livecd.py b/mic/imager/livecd.py index df613a4..febcd37 100644 --- a/mic/imager/livecd.py +++ b/mic/imager/livecd.py @@ -24,6 +24,7 @@ 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): @@ -306,7 +307,7 @@ class LiveImageCreatorBase(LoopImageCreator): if self.pack_to: isoimg = os.path.join(self._outdir, self.name + ".iso") packimg = os.path.join(self._outdir, self.pack_to) - misc.packing(packimg, isoimg) + packing(packimg, isoimg) os.unlink(isoimg) self.image_files.update({'image_files': [self.pack_to]}) else: diff --git a/mic/imager/liveusb.py b/mic/imager/liveusb.py index 3c01f39..8a5068f 100644 --- a/mic/imager/liveusb.py +++ b/mic/imager/liveusb.py @@ -24,7 +24,7 @@ from mic.utils import misc, fs_related, runner from mic.utils.errors import CreatorError, MountError from mic.utils.partitionedfs import PartitionedMount from mic.imager.livecd import LiveCDImageCreator - +from mic.archive import packing class LiveUSBImageCreator(LiveCDImageCreator): img_format = 'liveusb' @@ -302,7 +302,7 @@ class LiveUSBImageCreator(LiveCDImageCreator): self.image_files.update({'image_files': self.pack_to}) usbimg = os.path.join(self._outdir, self.name + ".usbimg") packimg = os.path.join(self._outdir, self.pack_to) - misc.packing(packimg, usbimg) + packing(packimg, usbimg) os.unlink(usbimg) else: self.image_files.update({'image_files': self.name + ".usbimg"}) diff --git a/mic/imager/loop.py b/mic/imager/loop.py index 049406c..6d63d1d 100644 --- a/mic/imager/loop.py +++ b/mic/imager/loop.py @@ -23,6 +23,7 @@ from mic import kickstart, msger from mic.utils.errors import CreatorError, MountError from mic.utils import misc, runner, fs_related as fs from mic.imager.baseimager import BaseImageCreator +from mic.archive import packing, compressing # The maximum string length supported for LoopImageCreator.fslabel @@ -394,7 +395,7 @@ class LoopImageCreator(BaseImageCreator): self.image_files.setdefault('partitions', {}).update( {item['mountpoint']: item['label']}) if self.compress_image: - misc.compressing(imgfile, self.compress_image) + compressing(imgfile, self.compress_image) self.image_files.setdefault('image_files', []).append( '.'.join([item['name'], self.compress_image])) else: @@ -407,7 +408,7 @@ class LoopImageCreator(BaseImageCreator): else: msger.info("Pack all loop images together to %s" % self.pack_to) dstfile = os.path.join(self._outdir, self.pack_to) - misc.packing(dstfile, self.__imgdir) + packing(dstfile, self.__imgdir) self.image_files['image_files'] = [self.pack_to] diff --git a/mic/imager/raw.py b/mic/imager/raw.py index 6b53ac6..2c4e068 100644 --- a/mic/imager/raw.py +++ b/mic/imager/raw.py @@ -24,7 +24,7 @@ from mic.utils import fs_related, runner, misc from mic.utils.partitionedfs import PartitionedMount from mic.utils.errors import CreatorError, MountError from mic.imager.baseimager import BaseImageCreator - +from mic.archive import packing, compressing class RawImageCreator(BaseImageCreator): """Installs a system into a file containing a partitioned disk image. @@ -458,7 +458,7 @@ class RawImageCreator(BaseImageCreator): if imgfile.endswith('.raw') or imgfile.endswith('bin'): imgpath = os.path.join(self.__imgdir, imgfile) msger.info("Compressing image %s" % imgfile) - misc.compressing(imgpath, self.compress_image) + compressing(imgpath, self.compress_image) if imgfile.endswith('.raw') and not self.pack_to: for disk in self.__disks.keys(): if imgfile.find(disk) != -1: @@ -471,7 +471,7 @@ class RawImageCreator(BaseImageCreator): if self.pack_to: dst = os.path.join(self._outdir, self.pack_to) msger.info("Pack all raw images to %s" % dst) - misc.packing(dst, self.__imgdir) + packing(dst, self.__imgdir) self.image_files.update({'image_files': self.pack_to}) else: msger.debug("moving disks to stage location") |