dracut/0018-feat-dracut-initramfs-restore-unpack-erofs-images.patch
Pavel Valena a3b408b277 Upgrade to dracut 103
- enable dracut-cpio binary
- feat(fips-crypto-policies): make c-p follow FIPS mode automatically
- fix(fips-crypto-policies): make it depend on fips dracut module

Resolves: RHEL-59678,RHEL-65204

From-source-git-commit: ff3186be9d5871c6ec216019463199bb78cc1b32
2024-11-01 18:42:50 +01:00

60 lines
2.0 KiB
Diff

From ac4b18bf89bfa440ff741557fe9928cd2b19b66e Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Tue, 30 Jul 2024 17:24:28 +0200
Subject: [PATCH 18/32] 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 74725308..98cfaed7 100755
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -81,12 +81,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