- stage2 support for DD repos
- get all modules which were loaded from DD
- get the RPMs using filedependencies
- install everything into the target system
---
anaconda | 4 ++++
backend.py | 17 ++++++++++++-----
constants.py | 5 +++++
flags.py | 1 +
yuminstall.py | 39 +++++++++++++++++++++++++++++----------
5 files changed, 51 insertions(+), 15 deletions(-)
@@ -666,6 +667,9 @@ if __name__ == "__main__":
# Default is to prompt to mount the installed system.
anaconda.rescue_mount = not opts.rescue_nomount
+ if opts.dlabel: #autodetected driverdisc in use
+ flags.dlabel = True
+
if opts.noipv4:
flags.useIPv4 = False
diff --git a/backend.py b/backend.py
index fcd3571..4e425cf 100644
--- a/backend.py
+++ b/backend.py
@@ -73,8 +73,8 @@ class AnacondaBackend:
def copyFirmware(self, anaconda):
# Multiple driver disks may be loaded, so we need to glob for all
- # the firmware files in all the driver disk directories.
- for f in glob.glob("/tmp/DD-*/firmware/*"):
+ # the firmware files in the common DD firmware directory
+ for f in glob.glob(DD_EXTRACTED+"/lib/firmware/*"):
try:
shutil.copyfile(f, "%s/lib/firmware/" % anaconda.rootPath)
except IOError, e:
@@ -94,16 +94,23 @@ class AnacondaBackend:
has_iscsi_disk = True
break
- if anaconda.id.extraModules:
- self.copyFirmware(anaconda)
+ #always copy the firmware files from DD
+ self.copyFirmware(anaconda)
if anaconda.id.extraModules or has_iscsi_disk:
for (n, arch, tag) in self.kernelVersionList(anaconda.rootPath):
packages.recreateInitrd(n, anaconda.rootPath)
- for d in glob.glob("/tmp/DD-*"):
+ #copy RPMS
+ for d in glob.glob(DD_RPMS):
shutil.copytree(d, "/root/" + os.path.basename(d))
sys.stdout.flush()
diff --git a/constants.py b/constants.py
index 9c4fbb1..fb81c90 100644
--- a/constants.py
+++ b/constants.py
@@ -82,3 +82,8 @@ else:
# this string will be combined with "An unhandled exception"...
# the leading space is not a typo.
exceptionText += _(" against anaconda at %s") %(bugzillaUrl,)
+
+# DriverDisc Paths
+DD_EXTRACTED = "/tmp/DD"
+DD_RPMS = "/tmp/DD-*"
+
diff --git a/flags.py b/flags.py
index 93472e3..e0d7329 100644
--- a/flags.py
+++ b/flags.py
@@ -70,6 +70,7 @@ class Flags:
self.__dict__['flags']['test'] = 0
self.__dict__['flags']['rootpath'] = 0
self.__dict__['flags']['livecdInstall'] = 0
+ self.__dict__['flags']['dlabel'] = 0
self.__dict__['flags']['ibft'] = 1
self.__dict__['flags']['iscsi'] = 0
self.__dict__['flags']['serial'] = 0
diff --git a/yuminstall.py b/yuminstall.py
index accf452..4eac19c 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -649,16 +649,18 @@ class AnacondaYum(YumSorter):
extraRepos = []
- if self.anaconda.id.extraModules:
- for d in glob.glob("/tmp/DD-*/rpms"):
- dirname = os.path.basename(os.path.dirname(d))
- rid = "anaconda-%s" % dirname
-
- repo = AnacondaYumRepo(rid)
- repo.baseurl = [ "file:///%s" % d ]
- repo.name = "Driver Disk %s" % dirname.split("-")[1]
- repo.enable()
- extraRepos.append(repo)
+ (_, _, _, _, ddArch) = os.uname()
+
+ #Add the Driver disc repos to Yum
+ for d in glob.glob(DD_RPMS):
+ dirname = os.path.basename(d)
+ rid = "anaconda-%s" % dirname
+
+ repo = AnacondaYumRepo(rid)
+ repo.baseurl = [ "file:///%s" % d ]
+ repo.name = "Driver Disk %s" % dirname.split("-")[1]
+ repo.enable()
+ extraRepos.append(repo)
if self.anaconda.isKickstart:
# This is the same pattern as from loader/urls.c:splitProxyParam.
@@ -1292,6 +1294,23 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
log.info("selecting package %s for module %s" % (pkg.name, name))
self.ayum.install(po=pkg)
+ #We need to install the packages which contain modules from DriverDiscs
+ for modPath in isys.modulesWithPaths():
+ if modPath.startswith(DD_EXTRACTED):
+ moduleProvides = modPath[len(DD_EXTRACTED):]
+ else:
+ continue
+
+ pkgs = self.ayum.returnPackagesByDep(moduleProvides)
+
+ if not pkgs:
+ log.warning("Didn't find any package providing %s" % (modPath,))
+
+ for pkg in pkgs:
+ log.info("selecting package %s for %s" % (pkg.name, modPath))
+ self.ayum.install(po=pkg)
+
+
def selectBestKernel(self, anaconda):
"""Find the best kernel package which is available and select it."""
--
1.6.4.4
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
12-07-2009, 07:48 PM
David Cantrell
Install DD RPMs
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
General comment for Python coding style (even more important than C)... let's
all follow PEP 8 -or- at least adhere to the existing coding style in the file
we are modifying.
On Wed, 2 Dec 2009, Martin Sivak wrote:
- stage2 support for DD repos
- get all modules which were loaded from DD
- get the RPMs using filedependencies
- install everything into the target system
@@ -666,6 +667,9 @@ if __name__ == "__main__":
# Default is to prompt to mount the installed system.
anaconda.rescue_mount = not opts.rescue_nomount
+ if opts.dlabel: #autodetected driverdisc in use
+ flags.dlabel = True
+
if opts.noipv4:
flags.useIPv4 = False
diff --git a/backend.py b/backend.py
index fcd3571..4e425cf 100644
--- a/backend.py
+++ b/backend.py
@@ -73,8 +73,8 @@ class AnacondaBackend:
def copyFirmware(self, anaconda):
# Multiple driver disks may be loaded, so we need to glob for all
- # the firmware files in all the driver disk directories.
- for f in glob.glob("/tmp/DD-*/firmware/*"):
+ # the firmware files in the common DD firmware directory
+ for f in glob.glob(DD_EXTRACTED+"/lib/firmware/*"):
try:
shutil.copyfile(f, "%s/lib/firmware/" % anaconda.rootPath)
except IOError, e:
@@ -94,16 +94,23 @@ class AnacondaBackend:
has_iscsi_disk = True
break
- if anaconda.id.extraModules:
- self.copyFirmware(anaconda)
+ #always copy the firmware files from DD
+ self.copyFirmware(anaconda)
if anaconda.id.extraModules or has_iscsi_disk:
for (n, arch, tag) in self.kernelVersionList(anaconda.rootPath):
packages.recreateInitrd(n, anaconda.rootPath)
- for d in glob.glob("/tmp/DD-*"):
+ #copy RPMS
+ for d in glob.glob(DD_RPMS):
shutil.copytree(d, "/root/" + os.path.basename(d))
sys.stdout.flush()
diff --git a/constants.py b/constants.py
index 9c4fbb1..fb81c90 100644
--- a/constants.py
+++ b/constants.py
@@ -82,3 +82,8 @@ else:
# this string will be combined with "An unhandled exception"...
# the leading space is not a typo.
exceptionText += _(" against anaconda at %s") %(bugzillaUrl,)
+
+# DriverDisc Paths
+DD_EXTRACTED = "/tmp/DD"
+DD_RPMS = "/tmp/DD-*"
+
diff --git a/flags.py b/flags.py
index 93472e3..e0d7329 100644
--- a/flags.py
+++ b/flags.py
@@ -70,6 +70,7 @@ class Flags:
self.__dict__['flags']['test'] = 0
self.__dict__['flags']['rootpath'] = 0
self.__dict__['flags']['livecdInstall'] = 0
+ self.__dict__['flags']['dlabel'] = 0
self.__dict__['flags']['ibft'] = 1
self.__dict__['flags']['iscsi'] = 0
self.__dict__['flags']['serial'] = 0
diff --git a/yuminstall.py b/yuminstall.py
index accf452..4eac19c 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -649,16 +649,18 @@ class AnacondaYum(YumSorter):
extraRepos = []
- if self.anaconda.id.extraModules:
- for d in glob.glob("/tmp/DD-*/rpms"):
- dirname = os.path.basename(os.path.dirname(d))
- rid = "anaconda-%s" % dirname
-
- repo = AnacondaYumRepo(rid)
- repo.baseurl = [ "file:///%s" % d ]
- repo.name = "Driver Disk %s" % dirname.split("-")[1]
- repo.enable()
- extraRepos.append(repo)
+ (_, _, _, _, ddArch) = os.uname()
'ddArch = os.uname()[4]' instead?
+
+ #Add the Driver disc repos to Yum
+ for d in glob.glob(DD_RPMS):
+ dirname = os.path.basename(d)
+ rid = "anaconda-%s" % dirname
+
+ repo = AnacondaYumRepo(rid)
+ repo.baseurl = [ "file:///%s" % d ]
+ repo.name = "Driver Disk %s" % dirname.split("-")[1]
+ repo.enable()
+ extraRepos.append(repo)
if self.anaconda.isKickstart:
# This is the same pattern as from loader/urls.c:splitProxyParam.
@@ -1292,6 +1294,23 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
log.info("selecting package %s for module %s" % (pkg.name, name))
self.ayum.install(po=pkg)
+ #We need to install the packages which contain modules from DriverDiscs
+ for modPath in isys.modulesWithPaths():
+ if modPath.startswith(DD_EXTRACTED):
+ moduleProvides = modPath[len(DD_EXTRACTED):]
+ else:
+ continue
+
+ pkgs = self.ayum.returnPackagesByDep(moduleProvides)
+
+ if not pkgs:
+ log.warning("Didn't find any package providing %s" % (modPath,))
+
+ for pkg in pkgs:
+ log.info("selecting package %s for %s" % (pkg.name, modPath))
+ self.ayum.install(po=pkg)
+
+
def selectBestKernel(self, anaconda):
"""Find the best kernel package which is available and select it."""