Skip to content

Commit

Permalink
feat(dmdquash-live): add support for using erofs
Browse files Browse the repository at this point in the history
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 ca5ae5d)

Resolves: RHEL-43460
  • Loading branch information
bcl authored and pvalena committed Aug 7, 2024
1 parent a9a0e9d commit 1487a70
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules.d/90dmsquash-live/dmsquash-live-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1487a70

Please sign in to comment.