Also fixes change to CD/DVD target in repo dialogs. repo=cdrom: option is parsed according to documentation (optional device name can follow). Media change works if the format of device was detected correctly by storage code (e.g. CD was present in drive in time of detection). --- anaconda | 17 +------- yuminstall.py | 129 ++++++++++++++++++++++++++++++--------------------------- 2 files changed, 69 insertions(+), 77 deletions(-) diff --git a/anaconda b/anaconda index 4f63977..26acd5a 100755 --- a/anaconda +++ b/anaconda @@ -488,21 +488,6 @@ class Anaconda: b = instClass.getBackend() self.backend = apply(b, (self,)) - def setMethodstr(self, methodstr): - if methodstr.startswith("cdrom://"): - (device, tree) = string.split(methodstr[8:], ":", 1) - - if not tree.startswith("/"): - tree = "/%s" %(tree,) - - if device.startswith("/dev/"): - device = device[5:] - - self.mediaDevice = device - self.methodstr = "cdrom://%s" % tree - else: - self.methodstr = methodstr - def requiresNetworkInstall(self): fail = False numNetDevs = isys.getNetworkDeviceCount() @@ -627,7 +612,7 @@ if __name__ == "__main__": if opts.method[0] == '@': opts.method = expandFTPMethod(opts.method) - anaconda.setMethodstr(opts.method) + anaconda.methodstr = opts.method else: anaconda.methodstr = None diff --git a/yuminstall.py b/yuminstall.py index a8571ad..bfe71ab 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -310,6 +310,8 @@ class AnacondaYum(YumSorter): while True: try: + import pdb + pdb.set_trace() self.configBaseURL() break except SystemError, e: @@ -409,78 +411,83 @@ class AnacondaYum(YumSorter): self.currentMedia = discnum def configBaseURL(self): + + m = self.anaconda.methodstr or "cdrom:" + # We only have a methodstr if method= or repo= was passed to # anaconda. No source for this base repo (the CD media, NFS, # whatever) is mounted yet since loader only mounts the source # for the stage2 image. We need to set up the source mount # now. - if self.anaconda.methodstr: - m = self.anaconda.methodstr - - if m.startswith("hd:"): - if m.count(":") == 2: - (device, path) = m[3:].split(":") - else: - (device, fstype, path) = m[3:].split(":") - - if flags.cmdline.has_key("preupgrade"): - self._baseRepoURL = "file:///mnt/sysimage/%s" % path - else: - self.isodir = "/mnt/isodir/%s" % path - - # This takes care of mounting /mnt/isodir first. - self._switchImage(1) - self.mediagrabber = self.mediaHandler - elif m.startswith("nfsiso:"): - self.isodir = "/mnt/isodir" + if m.startswith("hd:"): + if m.count(":") == 2: + (device, path) = m[3:].split(":") + else: + (device, fstype, path) = m[3:].split(":") - # Calling _switchImage takes care of mounting /mnt/isodir first. - if not network.hasActiveNetDev(): - if not self.anaconda.intf.enableNetwork(): - self._baseRepoURL = None - return + if flags.cmdline.has_key("preupgrade"): + self._baseRepoURL = "file:///mnt/sysimage/%s" % path + else: + self.isodir = "/mnt/isodir/%s" % path + # This takes care of mounting /mnt/isodir first. self._switchImage(1) self.mediagrabber = self.mediaHandler - elif m.startswith("http:") or m.startswith("ftp:"): - self._baseRepoURL = m - elif m.startswith("nfs:"): - if not network.hasActiveNetDev(): - if not self.anaconda.intf.enableNetwork(): - self._baseRepoURL = None - - isys.mount(m[4:], self.tree, "nfs") - - # This really should be fixed in loader instead but for now see - # if there's images and if so go with this being an NFSISO - # install instead. - images = findIsoImages(self.tree, self.anaconda.intf.messageWindow) - if images != {}: - isys.umount(self.tree, removeDir=False) - self.anaconda.methodstr = "nfsiso:%s" % m[4:] - self.configBaseURL() + elif m.startswith("nfsiso:"): + self.isodir = "/mnt/isodir" + + # Calling _switchImage takes care of mounting /mnt/isodir first. + if not network.hasActiveNetDev(): + if not self.anaconda.intf.enableNetwork(): + self._baseRepoURL = None + return + + self._switchImage(1) + self.mediagrabber = self.mediaHandler + elif m.startswith("http:") or m.startswith("ftp:"): + self._baseRepoURL = m + elif m.startswith("nfs:"): + if not network.hasActiveNetDev(): + if not self.anaconda.intf.enableNetwork(): + self._baseRepoURL = None + + isys.mount(m[4:], self.tree, "nfs") + + # This really should be fixed in loader instead but for now see + # if there's images and if so go with this being an NFSISO + # install instead. + images = findIsoImages(self.tree, self.anaconda.intf.messageWindow) + if images != {}: + isys.umount(self.tree, removeDir=False) + self.anaconda.methodstr = "nfsiso:%s" % m[4:] + self.configBaseURL() + return + self._baseRepoURL = "file://%s" % self.tree + elif m.startswith("cdrom:"): + import pdb + pdb.set_trace() + self.anaconda.mediaDevice = m[6:] + if self.anaconda.mediaDevice.startswith("/dev/"): + self.anaconda.mediaDevice = self.anaconda.mediaDevice[5:] + + if not self.anaconda.mediaDevice: + import pdb + pdb.set_trace() + cdr = scanForMedia(self.tree, self.anaconda.id.storage) + if cdr: + self.anaconda.mediaDevice = cdr + self.currentMedia = 1 + log.info("found installation media on %s" % cdr) + else: + # No CD with media on it and no repo=/method= parameter, so + # default to using whatever's enabled in /etc/yum.repos.d/ + self._baseRepoURL = None return - self._baseRepoURL = "file://%s" % self.tree - elif m.startswith("cdrom:"): - # FIXME - self._switchCD(1) - self.mediagrabber = self.mediaHandler - self._baseRepoURL = "file://%s" % self.tree - else: - # No methodstr was given. In order to find an installation source, - # we should first check to see if there's a CD/DVD with packages - # on it, and then default to the mirrorlist URL. The user can - # always change the repo with the repo editor later. - cdr = scanForMedia(self.tree, self.anaconda.id.storage) - if cdr: - self.mediagrabber = self.mediaHandler - self.anaconda.mediaDevice = cdr - self.currentMedia = 1 - log.info("found installation media on %s" % cdr) else: - # No CD with media on it and no repo=/method= parameter, so - # default to using whatever's enabled in /etc/yum.repos.d/ - self._baseRepoURL = None + self._switchCD(1) + self.mediagrabber = self.mediaHandler + self._baseRepoURL = "file://%s" % self.tree + def configBaseRepo(self, root='/'): # Create the "base" repo object, assuming there is one. Otherwise we -- 1.6.0.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list