[PATCH] Fix rd.blacklist.driver when no /etc/modprobe.d exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/modules.d/90kernel-modules/parse-kernel.sh b/modules.d/90kernel-modules/parse-kernel.sh
index 485528b..7470905 100755
--- a/modules.d/90kernel-modules/parse-kernel.sh
+++ b/modules.d/90kernel-modules/parse-kernel.sh
@@ -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
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux