summaryrefslogtreecommitdiffstats
path: root/backend.py
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2007-03-05 19:36:01 +0000
committerJeremy Katz <katzj@redhat.com>2007-03-05 19:36:01 +0000
commit90f17c42ed6b5d737de3bce140c11d86846ab475 (patch)
treedb4495ae4b25988b47f7d32e5e9442fa3aabb992 /backend.py
parent0ab9699a5a224c8bd2f92be9f453abf88bee558c (diff)
downloadanaconda-90f17c42ed6b5d737de3bce140c11d86846ab475.tar.gz
anaconda-90f17c42ed6b5d737de3bce140c11d86846ab475.tar.xz
anaconda-90f17c42ed6b5d737de3bce140c11d86846ab475.zip
2007-03-05 Jeremy Katz <katzj@redhat.com>
* backend.py (AnacondaBackend.copyDriverDiskModules): Move to here so that it can be used generically or overridden per-backend (AnacondaBackend.doPostInstall): And call it. * yuminstall.py (YumBackend.doPostInstall): Remove specific module copy.
Diffstat (limited to 'backend.py')
-rw-r--r--backend.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/backend.py b/backend.py
index 698effc7b..d0c4f42d2 100644
--- a/backend.py
+++ b/backend.py
@@ -21,6 +21,7 @@ import logging
from syslogd import syslog
import kickstart
+import packages
from rhpl.translate import _
from flags import flags
@@ -51,7 +52,76 @@ class AnacondaBackend:
def doPreInstall(self, anaconda):
self.initLog(anaconda.id, anaconda.rootPath)
+ def copyDriverDiskModules(self, anaconda):
+ """Copy over modules from a driver disk."""
+ kernelVersions = self.kernelVersionList()
+ foundModule = 0
+
+ try:
+ f = open("/etc/arch")
+ arch = f.readline().strip()
+ del f
+ except IOError:
+ arch = os.uname()[2]
+
+ for (path, name) in anaconda.id.extraModules:
+ if not path:
+ path = "/modules.cgz"
+ pattern = ""
+ names = ""
+ for (n, arch, tag) in kernelVersions:
+ if tag == "base":
+ pkg = "kernel"
+ else:
+ pkg = "kernel-%s" %(tag,)
+
+ # version 1 path
+ pattern = pattern + " %s/%s/%s.ko " % (n, arch, name)
+ # version 0 path
+ pattern = pattern + " %s/%s.ko " % (n, name)
+ names = names + " %s.ko" % (name,)
+ command = ("cd %s/lib/modules; gunzip < %s | "
+ "%s/bin/cpio --quiet -iumd %s" %
+ (anaconda.rootPath, path, anaconda.rootPath, pattern))
+ log.info("running: '%s'" % (command, ))
+ os.system(command)
+
+ for (n, arch, tag) in kernelVersions:
+ if tag == "base":
+ pkg = "kernel"
+ else:
+ pkg = "kernel-%s" %(tag,)
+
+ toDir = "%s/lib/modules/%s/updates" % \
+ (anaconda.rootPath, n)
+ to = "%s/%s.ko" % (toDir, name)
+
+ if (os.path.isdir("%s/lib/modules/%s" %(anaconda.rootPath, n)) and not
+ os.path.isdir("%s/lib/modules/%s/updates" %(anaconda.rootPath, n))):
+ os.mkdir("%s/lib/modules/%s/updates" %(anaconda.rootPath, n))
+ if not os.path.isdir(toDir):
+ continue
+
+ for p in ("%s/%s.ko" %(arch, name), "%s.ko" %(name,)):
+ fromFile = "%s/lib/modules/%s/%s" % (anaconda.rootPath, n, p)
+
+ if (os.access(fromFile, os.R_OK)):
+ log.info("moving %s to %s" % (fromFile, to))
+ os.rename(fromFile, to)
+ # the file might not have been owned by root in the cgz
+ os.chown(to, 0, 0)
+ foundModule = 1
+ else:
+ log.warning("missing DD module %s (this may be okay)" %
+ fromFile)
+
+ if foundModule == 1:
+ for (n, arch, tag) in kernelVersions:
+ packages.recreateInitrd(n, anaconda.rootPath)
+
def doPostInstall(self, anaconda):
+ self.copyDriverDiskModules(anaconda)
+
sys.stdout.flush()
if flags.setupFilesystems:
syslog.stop()