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

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