Blame SOURCES/0486-dracut.sh-fail-hard-if-we-find-modules-and-modules.d.patch

18971c
From 9301650e17a24194b0a4f78d8f91b87ef62d46dc Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Wed, 13 Jan 2016 09:32:24 +0100
18971c
Subject: [PATCH] dracut.sh: fail hard, if we find modules and modules.dep is
18971c
 missing
18971c
18971c
If modules are present in /lib/modules/<kernelversion> and modules.dep
18971c
is empty, depmod was not run most likely.
18971c
---
18971c
 dracut.sh | 11 ++++++++---
18971c
 1 file changed, 8 insertions(+), 3 deletions(-)
18971c
18971c
diff --git a/dracut.sh b/dracut.sh
18971c
index e45dc7bb..f4e85095 100755
18971c
--- a/dracut.sh
18971c
+++ b/dracut.sh
18971c
@@ -969,9 +969,14 @@ esac
18971c
 abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
18971c
 
18971c
 if [[ -d $srcmods ]]; then
18971c
-    [[ -f $srcmods/modules.dep ]] || {
18971c
-      dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
18971c
-    }
18971c
+    if ! [[ -f $srcmods/modules.dep ]]; then
18971c
+        if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
18971c
+            dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
18971c
+            exit 1
18971c
+        else
18971c
+            dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
18971c
+        fi
18971c
+    fi
18971c
 fi
18971c
 
18971c
 if [[ ! $print_cmdline ]]; then