X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FWriteModprobeConfig.py;h=9509d5ea4a7e614f9913ee1a751f0313113b582b;hb=1f49fe3a4819fc29a8739e9bd791adc4306a2edb;hp=a50fcc459ebf59efc658032a62abc9c0a3a016e9;hpb=ae73c450bffe036dccf37e8d96a4b655c3cd900e;p=bootmanager.git diff --git a/source/steps/WriteModprobeConfig.py b/source/steps/WriteModprobeConfig.py index a50fcc4..9509d5e 100644 --- a/source/steps/WriteModprobeConfig.py +++ b/source/steps/WriteModprobeConfig.py @@ -1,5 +1,8 @@ -#!/usr/bin/python2 -u - +#!/usr/bin/python +# +# $Id$ +# $URL$ +# # Copyright (c) 2003 Intel Corporation # All rights reserved. # @@ -13,6 +16,8 @@ import utils import systeminfo import BootAPI import ModelOptions +import notify_messages +import modprobe def Run( vars, log, filename = "/etc/modprobe.conf"): """ @@ -50,30 +55,38 @@ def Run( vars, log, filename = "/etc/modprobe.conf"): if sysmods is None: raise BootManagerException, "Unable to get list of system modules." - eth_count= 0 + # parse the existing modprobe.conf file, if one exists + mfile = "%s/%s" % (SYSIMG_PATH,filename) + m = modprobe.Modprobe() + if os.path.exists(mfile): + m.input(mfile) + + blacklist = modprobe.Modprobe() + blacklistfiles = ("blacklist","blacklist-compat","blacklist-firewire") + for blf in blacklistfiles: + if os.path.exists("/etc/modprobe.d/%s"%blf): + blacklist.input("/etc/modprobe.d/%s"%blf) + + # storage devices + m.optionsset("ata_generic","all_generic_ide=1") scsi_count= 0 - - modulesconf_file= file("%s/%s" % (SYSIMG_PATH,filename), "w" ) - - for type in sysmods: - if type == systeminfo.MODULE_CLASS_SCSI: - for a_mod in sysmods[type]: - if scsi_count == 0: - modulesconf_file.write( "alias scsi_hostadapter %s\n" % - a_mod ) - else: - modulesconf_file.write( "alias scsi_hostadapter%d %s\n" % - (scsi_count,a_mod) ) - scsi_count= scsi_count + 1 - - elif type == systeminfo.MODULE_CLASS_NETWORK: - for a_mod in sysmods[type]: - modulesconf_file.write( "alias eth%d %s\n" % - (eth_count,a_mod) ) - eth_count= eth_count + 1 - - modulesconf_file.close() - modulesconf_file= None + for a_mod in sysmods[systeminfo.MODULE_CLASS_SCSI]: + if m.blacklistget(a_mod) <> None or \ + blacklist.blacklistget(a_mod) <> None: + continue + m.aliasset("scsi_hostadapter%d"%scsi_count,a_mod) + scsi_count= scsi_count + 1 + + # network devices + eth_count= 0 + for a_mod in sysmods[systeminfo.MODULE_CLASS_NETWORK]: + if m.blacklistget(a_mod) <> None or \ + blacklist.blacklistget(a_mod) <> None: + continue + m.aliasset("eth%d"%eth_count,a_mod) + eth_count= eth_count + 1 + m.output(mfile, "BootManager") + m.output("%s.bak"%mfile, "BootManager") # write a backup version of this file # dump the modprobe.conf file to the log (not to screen) log.write( "Contents of new modprobe.conf file:\n" ) @@ -90,7 +103,7 @@ def Run( vars, log, filename = "/etc/modprobe.conf"): if eth_count == 0: log.write( "\nIt appears we don't have any network drivers. Aborting.\n" ) - vars['BOOT_STATE']= 'dbg' + vars['RUN_LEVEL']= 'failboot' vars['STATE_CHANGE_NOTIFY']= 1 vars['STATE_CHANGE_NOTIFY_MESSAGE']= \ notify_messages.MSG_NO_DETECTED_NETWORK