docs/livecd-creator.pod |    7 +++++++
 imgcreate/fs.py         |   12 ++++++++----
 imgcreate/live.py       |    8 ++++++--
 tools/livecd-creator    |    4 ++++
 4 files changed, 25 insertions(+), 6 deletions(-)

New commits:
commit c7c5bbbae768788de3bcc7089d369a45a89cda97
Author: Bruno Wolff III <[email protected]>
Date:   Sat Jun 19 12:07:50 2010 -0500

    Support for specifying a compressor.

diff --git a/docs/livecd-creator.pod b/docs/livecd-creator.pod
index b275e65..880ae19 100644
--- a/docs/livecd-creator.pod
+++ b/docs/livecd-creator.pod
@@ -40,6 +40,13 @@ Add packages to an existing live CD iso9660 image.
 
 Defines the file system label. The default is based on the configuration name.
 
+=item --compression-type=COMPRESSOR
+
+Specify a compressor recognized by mksquashfs. The default is zlib. lzma
+currently requires a custom kernel to produce a functional image. If zlib
+is used, the -comp option is not passed to mksquashfs to allow the use of
+older versions of mksquashfs.
+
 =back
 
 =head1 SYSTEM DIRECTORY OPTIONS
diff --git a/imgcreate/fs.py b/imgcreate/fs.py
index f5eed39..142ecd2 100644
--- a/imgcreate/fs.py
+++ b/imgcreate/fs.py
@@ -40,8 +40,12 @@ def makedirs(dirname):
         if err != errno.EEXIST:
             raise
 
-def mksquashfs(in_img, out_img):
-    args = ["/sbin/mksquashfs", in_img, out_img]
+def mksquashfs(in_img, out_img, compress_type):
+# Allow zlib to work for older versions of mksquashfs
+    if compress_type == "zlib":
+        args = ["/sbin/mksquashfs", in_img, out_img]
+    else:
+        args = ["/sbin/mksquashfs", in_img, out_img, "-comp", compress_type]
 
     if not sys.stdout.isatty():
         args.append("-no-progress")
@@ -553,7 +557,7 @@ class DeviceMapperSnapshot(object):
         except ValueError:
             raise SnapshotError("Failed to parse dmsetup status: " + out)
 
-def create_image_minimizer(path, image, target_size = None):
+def create_image_minimizer(path, image, compress_type, target_size = None):
     """
     Builds a copy-on-write image which can be used to
     create a device-mapper snapshot of an image where
@@ -591,7 +595,7 @@ def create_image_minimizer(path, image, target_size = None):
 
     cowloop.truncate(cow_used)
 
-    mksquashfs(cowloop.lofile, path)
+    mksquashfs(cowloop.lofile, path, compress_type)
 
     os.unlink(cowloop.lofile)
 
diff --git a/imgcreate/live.py b/imgcreate/live.py
index 856cce8..4f3bdd3 100644
--- a/imgcreate/live.py
+++ b/imgcreate/live.py
@@ -46,6 +46,9 @@ class LiveImageCreatorBase(LoopImageCreator):
         """
         LoopImageCreator.__init__(self, *args)
 
+        self.compress_type = "zlib"
+        """mksquashfs compressor to use."""
+
         self.skip_compression = False
         """Controls whether to use squashfs to compress the image."""
 
@@ -294,7 +297,7 @@ class LiveImageCreatorBase(LoopImageCreator):
             self._resparse()
 
             if not self.skip_minimize:
-                create_image_minimizer(self.__isodir + "/LiveOS/osmin.img", 
self._image)
+                create_image_minimizer(self.__isodir + "/LiveOS/osmin.img", 
self._image, self.compress_type)
 
             if self.skip_compression:
                 shutil.move(self._image, self.__isodir + "/LiveOS/ext3fs.img")
@@ -307,7 +310,8 @@ class LiveImageCreatorBase(LoopImageCreator):
                             os.path.join(os.path.dirname(self._image),
                                          "LiveOS", "ext3fs.img"))
                 mksquashfs(os.path.dirname(self._image),
-                           self.__isodir + "/LiveOS/squashfs.img")
+                           self.__isodir + "/LiveOS/squashfs.img",
+                           self.compress_type)
                 if os.stat(self.__isodir + "/LiveOS/squashfs.img").st_size >= 
4*1024*1024*1024:
                     self._isofstype = "udf"
                     logging.warn("Switching to UDF due to size of 
LiveOS/squashfs.img")
diff --git a/tools/livecd-creator b/tools/livecd-creator
index 39f7478..79fc944 100755
--- a/tools/livecd-creator
+++ b/tools/livecd-creator
@@ -41,6 +41,9 @@ def parse_options(args):
                       help="Add packages to an existing live CD iso9660 
image.")
     imgopt.add_option("-f", "--fslabel", type="string", dest="fs_label",
                       help="File system label (default based on config name)")
+    imgopt.add_option("", "--compression-type", type="string", 
dest="compress_type",
+                      help="Compression type recognized by mksquashfs (default 
zlib, lzma needs custom kernel)",
+                      default="zlib")
     parser.add_option_group(imgopt)
 
     # options related to the config of your system
@@ -113,6 +116,7 @@ def main():
 
     creator = imgcreate.LiveImageCreator(ks, name, fs_label)
     creator.tmpdir = os.path.abspath(options.tmpdir)
+    creator.compress_type = options.compress_type
     creator.skip_compression = options.skip_compression
     creator.skip_minimize = options.skip_minimize
     if options.cachedir:


--
livecd mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/livecd

Reply via email to