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.
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"]
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):
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:
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'
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"})
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
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:
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]
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.
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:
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")