]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
bail out if module directory does not exist
authorHarald Hoyer <harald@redhat.com>
Thu, 29 Jun 2017 15:09:29 +0000 (17:09 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 29 Jun 2017 15:09:50 +0000 (17:09 +0200)
this basically reverts commit 05214a0bedc084a41c35a128609745ad04a0c6cf

if people want to build the initramfs without kernel modules,
then --no-kernel should be specified

dracut.sh

index 64d9420198f14b425bb679d1e028b6dce181e4bb..4c41379867abed447001769d63baf220c65daa75 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -621,12 +621,6 @@ if ! [[ $kernel ]]; then
     kernel=$(uname -r)
 fi
 
-if [[ $kernel ]]; then
-    if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
-        printf -- "Kernel version $kernel has no module directory /lib/modules/$kernel\n" >&2
-    fi
-fi
-
 export LC_ALL=C
 export LANG=C
 unset LC_MESSAGES
@@ -894,6 +888,12 @@ else
     exit 1
 fi
 
+if [[ $no_kernel != yes ]] && ! [[ -d $srcmods ]]; then
+    printf "%s\n" "dracut: Cannot find module directory $srcmods" >&2
+    printf "%s\n" "dracut: and --no-kernel was not specified" >&2
+    exit 1
+fi
+
 if ! [[ $print_cmdline ]]; then
     inst /bin/sh
     if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then