git://git.onelab.eu
/
bootmanager.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4656074
)
- get_system_modules: allow kernel_version to be passed in
author
Mark Huang
<mlhuang@cs.princeton.edu>
Thu, 22 Sep 2005 22:25:13 +0000
(22:25 +0000)
committer
Mark Huang
<mlhuang@cs.princeton.edu>
Thu, 22 Sep 2005 22:25:13 +0000
(22:25 +0000)
source/systeminfo.py
patch
|
blob
|
history
diff --git
a/source/systeminfo.py
b/source/systeminfo.py
index
81900cc
..
8170ba2
100755
(executable)
--- a/
source/systeminfo.py
+++ b/
source/systeminfo.py
@@
-289,18
+289,18
@@
class systeminfo:
- def get_system_modules( self, install_root ):
+ def get_system_modules( self, install_root
, kernel_version= None
):
"""
Return a list of kernel modules that this system requires.
This requires access to the installed system's root
directory, as the following files must exist and are used:
<install_root>/usr/share/hwdata/pcitable
"""
Return a list of kernel modules that this system requires.
This requires access to the installed system's root
directory, as the following files must exist and are used:
<install_root>/usr/share/hwdata/pcitable
- <install_root>/lib/modules/(first entry)/modules.pcimap
- <install_root>/lib/modules/(first entry)/modules.dep
+ <install_root>/lib/modules/(first entry
if kernel_version unspecified
)/modules.pcimap
+ <install_root>/lib/modules/(first entry
if kernel version unspecified
)/modules.dep
-
Note, that this assumes there is only on
e kernel
-
that is installed. If there are more than one, the
n
-
only the first one in a directory listing
is used.
+
If there are more than one kernels installed, and th
e kernel
+
version is not specified, then only the first one i
n
+
/lib/modules
is used.
Returns a dictionary, keys being the type of module:
- scsi MODULE_CLASS_SCSI
Returns a dictionary, keys being the type of module:
- scsi MODULE_CLASS_SCSI
@@
-315,18
+315,20
@@
class systeminfo:
"""
# get the kernel version we are assuming
"""
# get the kernel version we are assuming
- try:
- kernel_version= os.listdir( "%s/lib/modules/" % install_root )
- except OSError, e:
- return
+ if kernel_version is None:
+ try:
+ kernel_version= os.listdir( "%s/lib/modules/" % install_root )
+ except OSError, e:
+ return
- if len(kernel_version) == 0:
- return
+ if len(kernel_version) == 0:
+ return
+
+ if len(kernel_version) > 1:
+ print( "WARNING: We may be returning modules for the wrong kernel." )
- if len(kernel_version) > 1:
- print( "WARNING: We may be returning modules for the wrong kernel." )
+ kernel_version= kernel_version[0]
- kernel_version= kernel_version[0]
print( "Using kernel version %s" % kernel_version )
# test to make sure the three files we need are present
print( "Using kernel version %s" % kernel_version )
# test to make sure the three files we need are present