diff options
author | Martin Sivak <msivak@redhat.com> | 2013-03-07 14:58:46 +0100 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2013-03-25 14:23:14 +0100 |
commit | 1a6826eb9ae1d8c63a48eb12ae7bb33f8b25a87d (patch) | |
tree | 290f53f7c6e38fc3a40079fc4da068f44b093c1f | |
parent | 8ee731c07a2356c82f2337035ef2f46eeb4b46f5 (diff) | |
download | anaconda-1a6826eb9ae1d8c63a48eb12ae7bb33f8b25a87d.tar.gz anaconda-1a6826eb9ae1d8c63a48eb12ae7bb33f8b25a87d.tar.xz anaconda-1a6826eb9ae1d8c63a48eb12ae7bb33f8b25a87d.zip |
Add driver updates code to anaconda install phase
-rw-r--r-- | dracut/anaconda-copy-driver-updates.sh | 7 | ||||
-rwxr-xr-x | dracut/driver-updates.sh | 4 | ||||
-rw-r--r-- | pyanaconda/driverupdates.py | 72 | ||||
-rw-r--r-- | pyanaconda/install.py | 15 |
4 files changed, 91 insertions, 7 deletions
diff --git a/dracut/anaconda-copy-driver-updates.sh b/dracut/anaconda-copy-driver-updates.sh index 353407fdd..39df56950 100644 --- a/dracut/anaconda-copy-driver-updates.sh +++ b/dracut/anaconda-copy-driver-updates.sh @@ -1,14 +1,11 @@ #!/bin/sh -# copy dup runtime files and downloaded DUPs -cp -ar /tmp/dud* /tmp/DD-* /sysroot/tmp - # copy all modules and firmwares for dud in /tmp/duds/DD-*; do # copy modules and firmwares to the proper directories # modules are in <kernel version>/{kernel,updates,extra}/* structure so # strip the kernel version and the first directory name of it - mkdir -p "/sysroot/lib/modules/$(uname -r)/updates" "/sysroot/lib/firmware/updates" - cp -r $dud/lib/modules/*/*/* "/sysroot/lib/modules/$(uname -r)/updates/" + mkdir -p "/sysroot/lib/modules/$(uname -r)/updates/DD" "/sysroot/lib/firmware/updates" + cp -r $dud/lib/modules/*/*/* "/sysroot/lib/modules/$(uname -r)/updates/DD" cp -r $dud/lib/firmware/* /sysroot/lib/firmware/ done diff --git a/dracut/driver-updates.sh b/dracut/driver-updates.sh index 3d09d0d54..327370faf 100755 --- a/dracut/driver-updates.sh +++ b/dracut/driver-updates.sh @@ -195,8 +195,8 @@ function driverupdatedisc() # copy modules and firmwares to the proper directories # modules are in <kernel version>/{kernel,updates,extra}/* structure so # strip the kernel version and the first directory name of it - mkdir -p "/lib/modules/$(uname -r)/updates" "/lib/firmware/updates" - cp -r /tmp/duds/DD-$num/lib/modules/*/*/* "/lib/modules/$(uname -r)/updates/" + mkdir -p "/lib/modules/$(uname -r)/updates/DD" "/lib/firmware/updates" + cp -r /tmp/duds/DD-$num/lib/modules/*/*/* "/lib/modules/$(uname -r)/updates/DD" cp -r /tmp/duds/DD-$num/lib/firmware/* /lib/firmware/ # copy binaries and libraries to / directory diff --git a/pyanaconda/driverupdates.py b/pyanaconda/driverupdates.py new file mode 100644 index 000000000..d0dd38980 --- /dev/null +++ b/pyanaconda/driverupdates.py @@ -0,0 +1,72 @@ +import os +import re +import pyanaconda.isys as isys + +__all__ = ["prepareDUDRepositories", "getDUDpackages"] + +# the DD modules are extracted and copied to /lib/modules/<kernel ver.>/updates/DD +DD_EXTRACTED = re.compile("/lib/modules/[^/]+/updates/DD/(?P<moduledir>[^/]+/)*(?P<modulename>[^/.]+).ko.*") +# where is the root for the tmp dir with all the DUP runtime files +DD_RUNTIME_DIR = "/var/run/initramfs/" + +import logging +log = logging.getLogger("anaconda") + +def prepareDUDRepositories(ksdata): + dd_extracted = os.path.join(DD_RUNTIME_DIR, "tmp", "dup_extracted.txt") + dd_repositories = {} + dd_names = {} + + # read driver update RPMS that were extracted + for record in open(dd_extracted): + (path, _content) = record.split(" ", 1) + # extract tmp and DD-* parts of the path + repository = os.path.split(path)[:1] + dd_name = repository[1] + # construct the whole path to the DD repository + repository_path = os.path.join(DD_RUNTIME_DIR, *repository) + # add it to the set of DD paths + dd_names.setdefault(repository_path, dd_name) + dd_repositories.setdefault(repository_path, []) + dd_repositories[path].append(path) + + # create repository objects + repositories = [] + for path in dd_repositories: + repo = ksdata.RepoData(name = dd_names[path], + baseurl = "file://%s" % path) + repositories.append(repo) + + return repositories + +# We might want to select just the packages that contain the actually +# loaded modules. Right now we only require kmod-<module> symbols +# which corresponds with how we did it in RHEL6, but might be not +# enough when the new RHEL7 requirements are taken into account +def getDUDpackages(payload): + moduleProvides = [] + packages = [] + + #We need to install the packages which contain modules from DriverDiscs + for modPath in isys.modulesWithPaths(): + log.debug("Checking for DUD module "+modPath) + match = DD_EXTRACTED.match(modPath) + if match: + log.info("Requesting install of kmod-%s" % (match.group("modulename"))) + moduleProvides.append("kmod-"+match.group("modulename")) + else: + continue + + for module in moduleProvides: + # this method is no longer available, do we need a replacement? + # pkgs = payload.returnPackagesByDep(module) + + #if not pkgs: + # log.warning("Didn't find any package providing %s" % module) + + #for pkg in pkgs: + # log.info("selecting package %s for %s" % (pkg.name, module)) + # packages.append(pkg) + packages.append(module) + + return packages diff --git a/pyanaconda/install.py b/pyanaconda/install.py index 08b396686..a1435b134 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -27,6 +27,7 @@ from pyanaconda.progress import progress_report from pyanaconda.users import createLuserConf, getPassAlgo, Users from pyanaconda import flags from pyanaconda import timezone +from pyanaconda.driverupdates import prepareDUDRepositories, getDUDpackages import gettext _ = lambda x: gettext.ldgettext("anaconda", x) @@ -128,6 +129,20 @@ def doInstall(storage, payload, ksdata, instClass): # system is bootable and configurable, and some other packages in order # to finish setting up the system. packages = storage.packages + ["authconfig", "firewalld"] + + # add Driver update RPMS and associated repositories to the transaction + dud_repositories = prepareDUDRepositories(ksdata) + for repository in dud_repositories: + payload.addRepo(repository) + payload.enableRepo(repository.name) + + # We might want to select just the packages that contain the actually + # loaded modules. Right now we only require kmod-<module> symbols + # which corresponds with how we did it in RHEL6, but might be not + # enough when the new RHEL7 requirements are taken into account + for pkg in getDUDpackages(payload): + packages.append(pkg) + payload.preInstall(packages=packages, groups=payload.languageGroups(ksdata.lang.lang)) payload.install() |