diff --git a/lorax.spec b/lorax.spec index 058bec16a..e282ca498 100644 --- a/lorax.spec +++ b/lorax.spec @@ -42,7 +42,7 @@ Requires: gzip Requires: isomd5sum Requires: module-init-tools Requires: parted -Requires: squashfs-tools >= 4.2 +Recommends: squashfs-tools >= 4.2 Requires: erofs-utils >= 1.8.2 Requires: util-linux Requires: xz-lzma-compat diff --git a/src/pylorax/cmdline/livemedia.py b/src/pylorax/cmdline/livemedia.py index 747ff6e32..328d9881f 100755 --- a/src/pylorax/cmdline/livemedia.py +++ b/src/pylorax/cmdline/livemedia.py @@ -158,6 +158,19 @@ def main(): list(log.error(e) for e in errors) sys.exit(1) + # When making an iso check for required mksquashfs or mkfs.erofs tools + # If mksquashfs is missing fall back to erofs + if opts.make_iso: + if opts.rootfs_type.startswith("squashfs"): + if not shutil.which("mksquashfs"): + log.warning("mksquashfs not installed, falling back to --rootfs-type=erofs") + opts.rootfs_type = "erofs" + + if opts.rootfs_type.startswith("erofs"): + if not shutil.which("mkfs.erofs"): + log.error("mkfs.erofs not installed, exiting") + sys.exit(1) + if not os.path.exists(opts.result_dir): os.makedirs(opts.result_dir) diff --git a/src/pylorax/cmdline/lorax.py b/src/pylorax/cmdline/lorax.py index 3ee7a29b3..d6163c80b 100755 --- a/src/pylorax/cmdline/lorax.py +++ b/src/pylorax/cmdline/lorax.py @@ -112,6 +112,18 @@ def main(): log_selinux_state() + # Check for required mksquashfs or mkfs.erofs tools + # If mksquashfs is missing fall back to erofs + if opts.rootfs_type.startswith("squashfs"): + if not shutil.which("mksquashfs"): + log.warning("mksquashfs not installed, falling back to --rootfs-type=erofs") + opts.rootfs_type = "erofs" + + if opts.rootfs_type.startswith("erofs"): + if not shutil.which("mkfs.erofs"): + log.error("mkfs.erofs not installed, exiting") + sys.exit(1) + if not opts.workdir: if not os.path.exists(opts.tmp): os.makedirs(opts.tmp)