dracut: enable initramfs building without kernel modules
authorHarald Hoyer <harald@redhat.com>
Mon, 18 Feb 2013 10:57:20 +0000 (11:57 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 18 Feb 2013 11:03:02 +0000 (12:03 +0100)
dracut-functions.sh
dracut.sh

index f7e3ec8..a2f366c 100755 (executable)
@@ -1499,13 +1499,16 @@ module_is_host_only() (
 
 find_kernel_modules_by_path () (
     local _OLDIFS
-        _OLDIFS=$IFS
-        IFS=:
-        while read a rest; do
-            [[ $a = */$1/* ]] || continue
-            echo $srcmods/$a
-        done < $srcmods/modules.dep
-        IFS=$_OLDIFS
+
+    [[ -f $srcmods/modules.dep ]] || return 0
+
+    _OLDIFS=$IFS
+    IFS=:
+    while read a rest; do
+        [[ $a = */$1/* ]] || continue
+        echo $srcmods/$a
+    done < $srcmods/modules.dep
+    IFS=$_OLDIFS
     return 0
 )
 
index e4c7043..4d17e4d 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -689,10 +689,11 @@ esac
 
 abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
 
-[[ -f $srcmods/modules.dep ]] || {
-    dfatal "$srcmods/modules.dep is missing. Did you run depmod?"
-    exit 1
-}
+if [[ -d $srcmods ]]; then
+    [[ -f $srcmods/modules.dep ]] || {
+      dwarn "$srcmods/modules.dep is missing. Did you run depmod?"
+    }
+fi
 
 if [[ -f $outfile && ! $force ]]; then
     dfatal "Will not override existing initramfs ($outfile) without --force"