[master/rhel7] driverdisk: Create a repo for network drivers (#1016004)
Vratislav Podzimek
vpodzime at redhat.com
Tue Feb 25 16:22:13 UTC 2014
On Tue, 2014-02-25 at 08:13 -0800, Brian C. Lane wrote:
> Network downloaded drivers (individual rpms) do not have a repo
> associated with them. This copies them over to the target system and
> creates a repository for them so that they will be installed.
>
> Resolves: rhbz#1016004
> ---
> dracut/driver-updates | 6 ++----
> pyanaconda/packaging/yumpayload.py | 33 +++++++++++++++++++++++++++------
> 2 files changed, 29 insertions(+), 10 deletions(-)
>
> diff --git a/dracut/driver-updates b/dracut/driver-updates
> index ea73981..d6fe92e 100755
> --- a/dracut/driver-updates
> +++ b/dracut/driver-updates
> @@ -542,15 +542,13 @@ def process_dd(dd_path):
> map(lambda d: setattr(d, "selected", True), drivers)
>
> # Copy the repository for Anaconda to use during install
> - if os.path.isdir(dd_path+"/repodata"):
> - copy_repo(dd_path, "/updates/run/install/DD-")
> + copy_repo(dd_path, "/updates/run/install/DD-")
>
> for driver in filter(lambda d: d.selected, drivers):
> dd_extract(driver, "/updates/")
>
> # Write the package names for all modules and firmware for Anaconda
> - if os.path.isdir(dd_path+"/repodata") \
> - and ("modules" in driver.flags or "firmwares" in driver.flags):
> + if "modules" in driver.flags or "firmwares" in driver.flags:
> with open("/run/install/dd_packages", "a") as f:
> f.write("%s\n" % driver.name)
>
> diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
> index 0d8fad2..d930c02 100644
> --- a/pyanaconda/packaging/yumpayload.py
> +++ b/pyanaconda/packaging/yumpayload.py
> @@ -41,6 +41,7 @@ import os
> import shutil
> import sys
> import time
> +from glob import glob
> from pyanaconda.iutil import execReadlines
>
> from . import *
> @@ -1428,24 +1429,44 @@ reposdir=%s
> # packages that were selected is in /run/install/dd_packages
>
> # Add repositories
> - dir_num = 1
> - repo_template="/run/install/DD-%d/%s/"
> + dir_num = 0
> while True:
> - repo = repo_template % (dir_num, blivet.arch.getArch())
> - if not os.path.isdir(repo+"repodata"):
> + dir_num += 1
> + repo = "/run/install/DD-%d/" % dir_num
> + if not os.path.isdir(repo):
> break
> +
> + # Drivers are under /<arch>/ or /DD-net/
> + if os.path.isdir(repo+"DD-net"):
> + repo += "DD-net"
> + elif os.path.isdir(repo+blivet.arch.getArch()):
> + repo += blivet.arch.getArch()
> + else:
> + log.debug("No driver repo in %s". repo)
> + continue
> +
> + # Run createrepo if there are rpms and no repodata
> + if not os.path.isdir(repo+"/repodata"):
> + rpms = glob(repo+"/*rpm")
> + if not rpms:
> + continue
> + log.info("Running createrepo on %s", repo)
> + iutil.execWithRedirect("createrepo", [repo])
> +
> ks_repo = self.data.RepoData(name="DD-%d" % dir_num,
> baseurl="file://"+repo,
> enabled=True)
> self.addRepo(ks_repo)
> - dir_num += 1
>
> # Add packages
> if not os.path.exists("/run/install/dd_packages"):
> return
> with open("/run/install/dd_packages", "r") as f:
> for line in f:
> - self._requiredPackages.append(line.strip())
> + package = line.strip()
> + if package not in self._requiredPackages:
> + self._requiredPackages.append(package)
> + log.debug("required packages = %s", self._requiredPackages)
>
> def checkSoftwareSelection(self):
> log.info("checking software selection")
ACK.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list