]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Fix rd.blacklist.driver when no /etc/modprobe.d exists
authorNicolas Chauvet <kwizart@gmail.com>
Mon, 5 Nov 2012 23:39:04 +0000 (00:39 +0100)
committerHarald Hoyer <harald@redhat.com>
Fri, 14 Dec 2012 08:04:55 +0000 (09:04 +0100)
This bug was reported as http://bugzilla.redhat.com/873220#c2

As the /etc/modprobe.d isn't created in the boot process
nor bundled within the initramfs, the initramfsblacklist.conf
cannot be created.

Instead, the /usr/lib/modprobe.d directory is available and using it
will restore the blacklist behavior.

modules.d/90kernel-modules/parse-kernel.sh

index 485528b7b4d7cd3a3083ca02613c02e5d4d400a8..7470905f80a84ce50e249225bf7f7b04e175e3b7 100755 (executable)
@@ -2,6 +2,15 @@
 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
+_modprobe_d=/etc/modprobe.d
+if [ -d /usr/lib/modprobe.d ] ; then
+    _modprobe_d=/usr/lib/modprobe.d
+elif [ -d /lib/modprobe.d ] ; then
+    _modprobe_d=/lib/modprobe.d
+elif [ ! -d $_modprobe_d ] ; then
+    mkdir -p $_modprobe_d
+fi
+
 for i in $(getargs rd.driver.pre -d rdloaddriver=); do
     (
         IFS=,
@@ -15,15 +24,15 @@ for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
     (
         IFS=,
         for p in $i; do
-            echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
+            echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
         done
     )
 done
 
 for p in $(getargs rd.driver.post -d rdinsmodpost=); do
-    echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
+    echo "blacklist $p" >>  $_modprobe_d/initramfsblacklist.conf
     _do_insmodpost=1
 done
 
 [ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
-unset _do_insmodpost
+unset _do_insmodpost _modprobe_d