From 3b4fe88a4259ec576a41d98b6aaee324a6b48b0f Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 10 Jul 2024 16:30:09 -0700 Subject: [PATCH 24/24] feat(dmdquash-live): add support for using erofs This adds support for rootfs compressed with erofs. Either as a plain erofs image or a LiveOS/rootfs.img ext4 filesystem compressed with erofs. This patch does not make any attempt to change the squashfs directory naming (or variable names) in order to make these changes as small as possible and easy to review. It also does not make any attempt to support the multitude of available options other than what is needed by anaconda-dracut calling this script to setup the boot.iso root filesystem. (which isn't to say it doesn't work, it just hasn't been tested and is outside the scope of this change). (cherry picked commit ca5ae5d3466eec40d118fc96d450478aa6faebb6) Resolves: RHEL-43460 --- modules.d/90dmsquash-live/dmsquash-live-root.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh index 4518852b..a376185e 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh @@ -97,7 +97,6 @@ det_img_fs() { blkid -s TYPE -u noraid -o value "$1" } -load_fstype squashfs CMDLINE=$(getcmdline) for arg in $CMDLINE; do case $arg in @@ -112,14 +111,15 @@ if [ -f "$livedev" ]; then # check filesystem type and handle accordingly fstype=$(det_img_fs "$livedev") case $fstype in - squashfs) SQUASHED=$livedev ;; - auto) die "cannot mount live image (unknown filesystem type)" ;; + squashfs | erofs) SQUASHED=$livedev ;; + auto) die "cannot mount live image (unknown filesystem type $fstype)" ;; *) FSIMG=$livedev ;; esac load_fstype "$fstype" else livedev_fstype=$(det_fs "$livedev") - if [ "$livedev_fstype" = "squashfs" ]; then + load_fstype "$livedev_fstype" + if [ "$livedev_fstype" = "squashfs" ] || [ "$livedev_fstype" = "erofs" ]; then # no mount needed - we've already got the LiveOS image in $livedev SQUASHED=$livedev elif [ "$livedev_fstype" != "ntfs" ]; then @@ -336,7 +336,7 @@ if [ -e "$SQUASHED" ]; then SQUASHED_LOOPDEV=$(losetup -f) losetup -r "$SQUASHED_LOOPDEV" $SQUASHED mkdir -m 0755 -p /run/initramfs/squashfs - mount -n -t squashfs -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs + mount -n -o ro "$SQUASHED_LOOPDEV" /run/initramfs/squashfs if [ -d /run/initramfs/squashfs/LiveOS ]; then if [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then -- 2.42.0