diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 2ccfb950..0ed470a4 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -187,7 +187,8 @@ class Lorax(BaseLoraxClass): add_arch_template_vars=None, verify=True, user_dracut_args=None, - skip_branding=False): + skip_branding=False, + squashfs_only=False): assert self._configured @@ -320,9 +321,16 @@ class Lorax(BaseLoraxClass): compressargs += ["-Xbcj", self.arch.bcj] else: logger.info("no BCJ filter for arch %s", self.arch.basearch) - rb.create_runtime(joinpaths(installroot,runtime), - compression=compression, compressargs=compressargs, - size=size) + if squashfs_only: + # Create an ext4 rootfs.img and compress it with squashfs + rb.create_squashfs_runtime(joinpaths(installroot,runtime), + compression=compression, compressargs=compressargs, + size=size) + else: + # Create an ext4 rootfs.img and compress it with squashfs + rb.create_ext4_runtime(joinpaths(installroot,runtime), + compression=compression, compressargs=compressargs, + size=size) rb.finished() logger.info("preparing to build output tree and boot images") diff --git a/src/pylorax/cmdline.py b/src/pylorax/cmdline.py index 869fc150..565b82bd 100644 --- a/src/pylorax/cmdline.py +++ b/src/pylorax/cmdline.py @@ -109,6 +109,8 @@ def lorax_parser(dracut_default=""): help="Do not verify SSL certificates") optional.add_argument("--skip-branding", action="store_true", default=False, help="Disable automatic branding package selection. Use --installpkgs to add custom branding.") + optional.add_argument("--squashfs-only", action="store_true", default=False, + help="Use a plain squashfs filesystem for the runtime.") # dracut arguments dracut_group = parser.add_argument_group("dracut arguments") diff --git a/src/pylorax/creator.py b/src/pylorax/creator.py index 8b085417..c004f34a 100644 --- a/src/pylorax/creator.py +++ b/src/pylorax/creator.py @@ -203,7 +203,7 @@ def make_runtime(opts, mount_dir, work_dir, size=None): rb = RuntimeBuilder(product, arch, fake_dbo) compression, compressargs = squashfs_args(opts) log.info("Creating runtime") - rb.create_runtime(joinpaths(work_dir, RUNTIME), size=size, + rb.create_ext4_runtime(joinpaths(work_dir, RUNTIME), size=size, compression=compression, compressargs=compressargs) diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index 19e39cfb..5547118c 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -229,7 +229,16 @@ class RuntimeBuilder(object): runcmd(["depmod", "-a", "-F", ksyms, "-b", root, kernel.version]) generate_module_info(moddir+kernel.version, outfile=moddir+"module-info") - def create_runtime(self, outfile="/var/tmp/squashfs.img", compression="xz", compressargs=None, size=2): + def create_squashfs_runtime(self, outfile="/var/tmp/squashfs.img", compression="xz", compressargs=None, size=2): + """Create a plain squashfs runtime""" + compressargs = compressargs or [] + os.makedirs(os.path.dirname(outfile)) + + # squash the rootfs + imgutils.mksquashfs(self.vars.root, outfile, compression, compressargs) + + def create_ext4_runtime(self, outfile="/var/tmp/squashfs.img", compression="xz", compressargs=None, size=2): + """Create a squashfs compressed ext4 runtime""" # make live rootfs image - must be named "LiveOS/rootfs.img" for dracut compressargs = compressargs or [] workdir = joinpaths(os.path.dirname(outfile), "runtime-workdir") diff --git a/src/sbin/lorax b/src/sbin/lorax index 3ae174fd..bb81e853 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -193,7 +193,8 @@ def main(): add_arch_template_vars=parsed_add_arch_template_vars, remove_temp=True, verify=opts.verify, user_dracut_args=opts.dracut_args, - skip_branding=opts.skip_branding) + skip_branding=opts.skip_branding, + squashfs_only=opts.squashfs_only) # Release the lock on the tempdir os.close(dir_fd)