dracut/0021-feat-dracut-initramfs-restore-unpack-erofs-images.patch

60 lines
2.0 KiB
Diff
Raw Normal View History

From 0d90ae671e130b631383fb481a1f38a175167eff Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Tue, 30 Jul 2024 17:24:28 +0200
Subject: [PATCH 21/24] feat(dracut-initramfs-restore): unpack erofs images
Follow the example for squashfs images and also unpack erofs images in
dracut-initramfs-restore.
Signed-off-by: Philipp Rudo <prudo@redhat.com>
(cherry picked from commit b390e194911835e6bd24eeeb0946e374852b8ddc)
Resolves: RHEL-43460
---
dracut-initramfs-restore.sh | 10 ++++++++--
modules.d/95squash-erofs/module-setup.sh | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
index cc561b22..015160b7 100755
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -74,12 +74,18 @@ else
exit 1
fi
-if [[ -d squash ]]; then
- if ! unsquashfs -no-xattrs -f -d . squash-root.img > /dev/null; then
+if [[ -f squashfs-root.img ]]; then
+ if ! unsquashfs -no-xattrs -f -d . squashfs-root.img > /dev/null; then
echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
rm -f -- /run/initramfs/shutdown
exit 1
fi
+elif [[ -f erofs-root.img ]]; then
+ if ! fsck.erofs --extract=. --overwrite erofs-root.img > /dev/null; then
+ echo "Squash module is enabled for this initramfs but failed to unpack erofs-root.img" >&2
+ rm -f -- /run/initramfs/shutdown
+ exit 1
+ fi
fi
if grep -q -w selinux /sys/kernel/security/lsm 2> /dev/null \
diff --git a/modules.d/95squash-erofs/module-setup.sh b/modules.d/95squash-erofs/module-setup.sh
index 71c2b672..d763a902 100755
--- a/modules.d/95squash-erofs/module-setup.sh
+++ b/modules.d/95squash-erofs/module-setup.sh
@@ -1,7 +1,7 @@
#!/bin/bash
check() {
- require_binaries mkfs.erofs || return 1
+ require_binaries mkfs.erofs fsck.erofs || return 1
require_kernel_modules erofs || return 1
return 255
--
2.42.0