a56a5e
From 815ab93fe9f57aa3e17066d9564ce5350f95b35a Mon Sep 17 00:00:00 2001
a56a5e
From: Harald Hoyer <harald@redhat.com>
a56a5e
Date: Fri, 12 Sep 2014 10:19:28 +0200
a56a5e
Subject: [PATCH] dracut-functions.sh: exit for missing  --force-add or --add
a56a5e
 dracut modules
a56a5e
a56a5e
Better exit with fail early, so there is no surprise on reboot.
a56a5e
a56a5e
(cherry picked from commit a49cac2e65eb1beb8b0442b74aaa4851d184c0ce)
a56a5e
---
a56a5e
 dracut-functions.sh | 10 ++++++++--
a56a5e
 1 file changed, 8 insertions(+), 2 deletions(-)
a56a5e
a56a5e
diff --git a/dracut-functions.sh b/dracut-functions.sh
1755ca
index 8a0cd301..6e0b44ae 100755
a56a5e
--- a/dracut-functions.sh
a56a5e
+++ b/dracut-functions.sh
a56a5e
@@ -1314,11 +1314,17 @@ for_each_module_dir() {
a56a5e
 
a56a5e
     # Report any missing dracut modules, the user has specified
a56a5e
     _modcheck="$add_dracutmodules $force_add_dracutmodules"
a56a5e
-    [[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
a56a5e
+    [[ $dracutmodules != all ]] && _modcheck="$_modcheck $dracutmodules"
a56a5e
     for _mod in $_modcheck; do
a56a5e
         [[ " $mods_to_load " == *\ $_mod\ * ]] && continue
a56a5e
-        [[ " $omit_dracutmodules " == *\ $_mod\ * ]] && continue
a56a5e
+
a56a5e
+        [[ " $force_add_dracutmodules " != *\ $_mod\ * ]] \
a56a5e
+            && [[ " $omit_dracutmodules " == *\ $_mod\ * ]] \
a56a5e
+            && continue
a56a5e
+
a56a5e
         derror "dracut module '$_mod' cannot be found or installed."
a56a5e
+        [[ " $force_add_dracutmodules " == *\ $_mod\ * ]] && exit 1
a56a5e
+        [[ " $add_dracutmodules " == *\ $_mod\ * ]] && exit 1
a56a5e
     done
a56a5e
 }
a56a5e