From c65be94a90ca38f456ac7508f285e0def2c05aae Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sun, 5 Jul 2009 23:55:09 -0500
Subject: LinHES-config: mv_install.py if modules are in /proc/cmdline add them
 to rc.conf

---
 abs/core-testing/LinHES-config/PKGBUILD      |  2 +-
 abs/core-testing/LinHES-config/mv_install.py | 42 ++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 37beb99..56cbd1a 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.0
-pkgrel=43
+pkgrel=44
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted ddcxinfo python-pexpect)
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 9d2e284..efee91e 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -770,6 +770,42 @@ def add_to_blacklist(module):
         f.write(newline)
     f.close()
 
+
+def add_to_modulelist(module):
+    rcfile = data_config.MOUNTPOINT + "/etc/rc.conf"
+    logging.debug("    Attempting to add %s to modulelist", 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("MODULES=",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:
@@ -789,6 +825,12 @@ def special_hardware_check():
             for module in modulelist.split(','):
                 add_to_blacklist(module)
 
+        if re.match("modules",item) != None :
+            logging.debug("    Found modules")
+            modulelist = item.split("=")[1]
+            for module in modulelist.split(','):
+                add_to_modulelist(module)
+
 
 def swapsearch():
 #currently unused!
-- 
cgit v0.12