Blob Blame History Raw
From debb3b29ca103e2dac8a3ccafe73f7f815b54979 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 12 Oct 2020 15:23:30 +0800
Subject: [PATCH] 99squash: Check require module earlier, and properly

Let 99squash fail earlier if required modules are not enabled or
missing, using the new added helper.

Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 83c65fd3db9f5f3436cfe74ec67d2894dedda397)

Resolves: #1959336
---
 dracut.sh                          | 11 -----------
 modules.d/99squash/module-setup.sh |  7 +++++++
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index 176b2259..2090d89f 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1736,17 +1736,6 @@ fi
 
 if dracut_module_included "squash"; then
     dinfo "*** Install squash loader ***"
-    for config in \
-      CONFIG_SQUASHFS \
-      CONFIG_OVERLAY_FS \
-      CONFIG_DEVTMPFS;
-    do
-      if ! check_kernel_config $config; then
-        dfatal "$config have to be enabled for dracut squash module to work"
-        exit 1
-      fi
-    done
-
     readonly squash_dir="$initdir/squash/root"
     readonly squash_img="$initdir/squash/root.img"
     readonly squash_candidate=( "usr" "etc" )
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 6307377c..e2fe3dd4 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -11,6 +11,13 @@ check() {
         return 1
     fi
 
+    for i in squashfs loop overlay; do
+        if ! check_kernel_module $i; then
+            derror "dracut-squash module requires kernel module $i"
+            return 1
+        fi
+    done
+
     return 255
 }