diff options
Diffstat (limited to 'abs')
-rwxr-xr-x | abs/core/LinHES-config/mv_install.py | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py index 1d5f6fe..72c94f8 100755 --- a/abs/core/LinHES-config/mv_install.py +++ b/abs/core/LinHES-config/mv_install.py @@ -1002,71 +1002,77 @@ def apply_new_auth(): logging.debug def add_to_blacklist(module): - rcfile = data_config.MOUNTPOINT + "/etc/rc.conf" + rcfile = data_config.MOUNTPOINT + "/etc/modprobe.d/install-blacklist.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, 'r') + #conflines = f.readlines() + #f.close() + #except: + #logging.critical(" *Couldn't open %s for reading",rcfile) + #return try: - f = open(rcfile, 'w') + f = open(rcfile, 'a') 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) + line = "blacklist %s \n" %module + f.write(line) + line = "install %s /bin/false \n" %module + f.write(line) f.close() + #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 add_to_modulelist(module): - rcfile = data_config.MOUNTPOINT + "/etc/rc.conf" + rcfile = data_config.MOUNTPOINT + "/etc/modules-load.d/install-autoload.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, 'r') + #conflines = f.readlines() + #f.close() + #except: + #logging.critical(" *Couldn't open %s for reading",rcfile) + #return try: - f = open(rcfile, 'w') + f = open(rcfile, '1') except: - logging.critical(" *Couldn't open %s for reading",rcfile) + logging.critical(" *Couldn't open %s for writing",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) + line = "%s" %module + f.write(line) f.close() + #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() @@ -1083,7 +1089,7 @@ def special_hardware_check(): logging.debug(" Boot options: %s", bootoptions) for item in bootoptions: logging.debug(item) - if re.match("disablemodules",item) != None : + if (re.match("disablemodules",item) != None) or (re.match("modprobe.blacklist",item) != None ): logging.debug(" Found disabledmodules") modulelist = item.split("=")[1] for module in modulelist.split(','): |