[master/rhel7 2/2] Write a modprobe blacklist (#1073130)

Brian C. Lane bcl at redhat.com
Tue Mar 18 17:00:58 UTC 2014


modules blacklisted with modprobe.blacklist during the installation will
be added to /etc/modprobe.d/anaconda-blacklist.conf so that they will
continue to be blacklisted after reboot.

Resolves: rhbz#1073130
---
 pyanaconda/packaging/__init__.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index f0453c5..47bb895 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -538,10 +538,26 @@ class Payload(object):
         """ Perform pre-installation tasks. """
         iutil.mkdirChain(ROOT_PATH + "/root")
 
+        self._writeModuleBlacklist()
+
     def install(self):
         """ Install the payload. """
         raise NotImplementedError()
 
+    def _writeModuleBlacklist(self):
+        """ Copy modules from modprobe.blacklist=<module> on cmdline to
+            /etc/modprobe.d/anaconda-blacklist.conf so that modules will
+            continue to be blacklisted when the system boots.
+        """
+        if "modprobe.blacklist" not in flags.cmdline:
+            return
+
+        iutil.mkdirChain(ROOT_PATH + "/etc/modprobe.d")
+        with open(ROOT_PATH + "/etc/modprobe.d/anaconda-blacklist.conf", "w") as f:
+            f.write("# Module blacklists written by anaconda\n")
+            for module in flags.cmdline["modprobe.blacklist"].split():
+                f.write("blacklist %s\n" % module)
+
     def _copyDriverDiskFiles(self):
         import glob
         import shutil
-- 
1.8.5.3



More information about the anaconda-patches mailing list