From 77e44fe619a659bad9faa3a06845f66df9e4527b Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Fri, 9 Nov 2012 09:45:41 -0600
Subject: LinHES-config: transfer grub line modules  to post install grub. This
 is in addition to blacklisting them in modules.conf.   This is needed because
 blacklisting a module doesn't work if it's in the initrd.

refs #726
closes #726
---
 abs/core/LinHES-config/09_mythvantge_runit_grub | 11 ++++++++--
 abs/core/LinHES-config/PKGBUILD                 |  6 +++---
 abs/core/LinHES-config/mv_install.py            | 27 ++++++++++++++++++++++---
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/abs/core/LinHES-config/09_mythvantge_runit_grub b/abs/core/LinHES-config/09_mythvantge_runit_grub
index 1d7774e..8bf7396 100644
--- a/abs/core/LinHES-config/09_mythvantge_runit_grub
+++ b/abs/core/LinHES-config/09_mythvantge_runit_grub
@@ -7,6 +7,13 @@ if [ -z "$boot_device_id" ]; then
 boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
 fi
 
+if [ -f "/etc/grub.d/install_modules" ]
+then
+    . /etc/grub.d/install_modules
+else
+    install_modules=''
+fi
+
 gettext_printf "Found LinHES runit: \n" >&2
 echo "
 menuentry 'LinHES' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-true-$boot_device_id' {
@@ -22,7 +29,7 @@ menuentry 'LinHES' --class arch --class gnu-linux --class gnu --class os $menuen
     search --no-floppy --fs-uuid --set=root $boot_device_id
     fi
     echo    'Loading Linux core repo kernel ...'
-    linux   /boot/vmlinuz-linux root=UUID=$boot_device_id ro  quiet splash=silent init=/sbin/runit
+    linux   /boot/vmlinuz-linux root=UUID=$boot_device_id ro  quiet splash=silent init=/sbin/runit $install_modules
     echo    'Loading initial ramdisk ...'
     initrd  /boot/initramfs-linux.img
     }
@@ -39,7 +46,7 @@ menuentry 'LinHES --no-splash' --class arch --class gnu-linux --class gnu --clas
       search --no-floppy --fs-uuid --set=root $boot_device_id
     fi
     echo    'Loading Linux core repo kernel ...'
-    linux   /boot/vmlinuz-linux root=UUID=$boot_device_id ro init=/sbin/runit
+    linux   /boot/vmlinuz-linux root=UUID=$boot_device_id ro init=/sbin/runit $install_modules
     echo    'Loading initial ramdisk ...'
     initrd  /boot/initramfs-linux.img
 }
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 1134402..f35c42f 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=184
+pkgrel=189
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -127,8 +127,8 @@ build() {
     install -o root -g root  -D -m 0755 blacklist_pcspkr.conf $startdir/pkg/etc/modprobe.d/blacklist_pcspkr.conf
     install -o root -g root  -D -m 0755 blacklist_nouveau.conf $startdir/pkg/etc/modprobe.d/blacklist_nouveau.conf
 }
-md5sums=('ecd120a453dd185fc2b345086bfd62f5'
-         'f33e1a6f7985091b8d47cbaf7433f90f'
+md5sums=('0bde52e0cc7708f3c208d4b424da49cc'
+         '48478aa0c2cfda6f6943c320b576d6f4'
          '17677b9e25b8fe3511ad3a139ed91eea'
          '2596460462cf6c889cf8f95485537b20'
          '985891a43f7c4c983eb2a362162f1a0f'
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index 877ca67..cb19f2b 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -1308,12 +1308,13 @@ def add_to_modulelist(module):
         #return
 
     try:
-        f = open(rcfile, '1')
+        f = open(rcfile, 'a+')
     except:
         logging.critical("    *Couldn't open %s for writing",rcfile)
         return
     line = "%s" %module
     f.write(line)
+    f.write("\n")
     f.close()
     #for line in conflines:
         #newline = line
@@ -1333,6 +1334,7 @@ def add_to_modulelist(module):
 
 
 def special_hardware_check():
+    outlist = []
     logging.info("_____Applying special boot parameters_______")
     try:
         f = open('/proc/cmdline', 'r')
@@ -1347,12 +1349,14 @@ def special_hardware_check():
         logging.debug(item)
         if (re.match("disablemodules",item) != None)  or  (re.match("modprobe.blacklist",item) != None ):
             logging.debug("    Found disabledmodules")
+            outlist.append(item)
             modulelist = item.split("=")[1]
             for module in modulelist.split(','):
                 add_to_blacklist(module)
 
         if re.match("modules",item) != None :
             logging.debug("    Found modules")
+            outlist.append(item)
             modulelist = item.split("=")[1]
             for module in modulelist.split(','):
                 add_to_modulelist(module)
@@ -1372,6 +1376,19 @@ def special_hardware_check():
         if re.match("no_meth",item) != None :
           cmd = "  touch %s%s/.no_meth" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
           runcmd(cmd)
+    if len(outlist) != 0:
+        outfile = data_config.MOUNTPOINT + "/etc/grub.d/install_modules"
+        logging.debug("    Writing out %s" %outfile)
+        try:
+            f = open(outfile, 'w')
+            templine =  ' '.join(outlist)
+            outline = '''install_modules='%s' \n''' %templine
+            f.write(outline)
+            f.write("\n")
+            f.close()
+        except:
+            logging.critical("    *Couldn't write %s" %outfile)
+        return
 
 def swapsearch():
 #currently unused!
@@ -1549,12 +1566,14 @@ def full_install(hostoptions):
     update_status(msg)
     progress(98)
 
+    special_hardware_check()
+
     mount_bind_chroot()
     grub_it()
     umount_bind_chroot()
 
     genlocale()  #currently does nothing
-    special_hardware_check()
+
 
     logging.info("______Configuring system________")
     cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig")
@@ -1872,6 +1891,8 @@ def upgrade(hostoptions):
     fstab_it("upgrade")
     time.sleep(1)
 
+    special_hardware_check()
+
     mount_bind_chroot()
     grub_it()
     umount_bind_chroot()
@@ -1879,7 +1900,7 @@ def upgrade(hostoptions):
     genlocale()
     time.sleep(1)
 
-    special_hardware_check()
+
     cp_and_log("/root/xorg.conf.install", data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
     #this was needed to get around a pacman bug
     cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab")
-- 
cgit v0.12