From b8302ff276a5110a3cd128eca7b7d8ed07eb1246 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 7 Jun 2009 11:04:59 -0500
Subject: linhes-config: on install poll /proc/cmdline for disabled modules and
 add them to /etc/rc.conf

---
 abs/core-testing/LinHES-config/mv_install.py | 55 ++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 1281932..97fbae5 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -689,6 +689,59 @@ def apply_new_auth():
         logging.debug("Applying password updates failed,  couldn't open %s", passfile)
     logging.debug
 
+def add_to_blacklist(module):
+    rcfile = data_config.MOUNTPOINT + "/etc/rc.conf"
+    logging.debug("    Attempting to add %s to blacklist", module)
+    newline=''
+    try:
+        f = open(rcfile, 'r')
+        conflines = f.readlines()
+        f.close()
+    except:
+        logging.critical("    *Couldn't open %s for reading",rcfile)
+        return
+
+    try:
+        f = open(rcfile, 'w')
+    except:
+        logging.critical("    *Couldn't open %s for reading",rcfile)
+        return
+
+    for line in conflines:
+        newline = line
+        if re.match("MOD_BLACKLIST",line):
+            logging.debug(line)
+            try:
+                lastpar = line.rindex(')')
+                logging.debug("    found ) at %s", lastpar)
+                newline = line[:lastpar] +" !" + module + " " + line[lastpar:]
+                logging.debug(newline)
+            except:
+                logging.debug("Couldn't find ending )")
+                newline = line
+        f.write(newline)
+    f.close()
+
+def special_hardware_check():
+    logging.info("_____Applying special boot parameters_______")
+    try:
+        f = open('/proc/cmdline', 'r')
+        bootoptions = f.readlines()
+        f.close()
+    except:
+        logging.critical("    *Couldn't open /proc/cmdline")
+        return
+    bootoptions =  bootoptions[0].split()
+    logging.debug("    Boot options: %s", bootoptions)
+    for item in bootoptions:
+        logging.debug(item)
+        if re.match("disablemodules",item) != None :
+            logging.debug("    Found disabledmodules")
+            modulelist = item.split("=")[1]
+            for module in modulelist.split(','):
+                add_to_blacklist(module)
+
+
 def swapsearch():
 #currently unused!
     partlist = []
@@ -820,6 +873,7 @@ def full_install(hostoptions):
     update_status(msg)
     progress(98)
     grub_it()
+    special_hardware_check()
 #   Configuring the system
     logging.info("______Configuring system________")
     cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig")
@@ -1058,6 +1112,7 @@ def upgrade(hostoptions):
     grub_it()
     time.sleep(1)
     #needed to get around a bug with pacman
+    special_hardware_check()
     cp_and_log("/root/xorg.conf.install", data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
     cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab")
     if clean_upgrade() or os.path.exists("/tmp/etc/KnoppMyth-version"):
-- 
cgit v0.12

