Blame 0018-dracut.sh-fail-hard-if-we-find-modules-and-modules.d.patch

Harald Hoyer b38677
From b019952f6df9b1dae54dd097f012e6c05fe6af00 Mon Sep 17 00:00:00 2001
Harald Hoyer b38677
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer b38677
Date: Wed, 13 Jan 2016 09:32:24 +0100
Harald Hoyer b38677
Subject: [PATCH] dracut.sh: fail hard, if we find modules and modules.dep is
Harald Hoyer b38677
 missing
Harald Hoyer b38677
Harald Hoyer b38677
If modules are present in /lib/modules/<kernelversion> and modules.dep
Harald Hoyer b38677
is empty, depmod was not run most likely.
Harald Hoyer b38677
---
Harald Hoyer b38677
 dracut.sh | 7 ++++++-
Harald Hoyer b38677
 1 file changed, 6 insertions(+), 1 deletion(-)
Harald Hoyer b38677
Harald Hoyer b38677
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer b38677
index 6dc9858..98dbe0b 100755
Harald Hoyer b38677
--- a/dracut.sh
Harald Hoyer b38677
+++ b/dracut.sh
Harald Hoyer b38677
@@ -925,7 +925,12 @@ abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
Harald Hoyer b38677
 
Harald Hoyer b38677
 if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
Harald Hoyer b38677
     if ! [[ -f $srcmods/modules.dep ]]; then
Harald Hoyer b38677
-        dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
Harald Hoyer b38677
+        if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
Harald Hoyer b38677
+            dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
Harald Hoyer b38677
+            exit 1
Harald Hoyer b38677
+        else
Harald Hoyer b38677
+            dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
Harald Hoyer b38677
+        fi
Harald Hoyer b38677
     elif ! ( command -v gzip &>/dev/null && command -v xz &>/dev/null); then
Harald Hoyer b38677
         read _mod < $srcmods/modules.dep
Harald Hoyer b38677
         _mod=${_mod%%:*}