diff options
-rwxr-xr-x | anaconda | 26 | ||||
-rw-r--r-- | yuminstall.py | 9 |
2 files changed, 24 insertions, 11 deletions
@@ -558,22 +558,28 @@ class Anaconda: # real URIs, though. self._loaderMethodstr = methodstr - if methodstr.startswith("nfs://"): - self.methodstr = "file:///" + methodstr[6:] - elif methodstr.startswith("nfsiso:/"): - self.methodstr = "file://" + methodstr[8:] - elif methodstr.startswith("cdrom://"): - (device, tree) = string.split(methodstr[8:], ":", 1) + # Make a best guess at where the repo is by trimming off the image file + # from the end. If this doesn't work, we've got repo reconfig screens + # to use later on. + if methodstr.endswith(".img"): + try: + m = methodstr[:methodstr.rindex("/")] + m = m[:m.rindex("/")] + except: + m = methodstr + else: + m = methodstr + + if m.startswith("cdrom://"): + (device, tree) = string.split(m[8:], ":", 1) if not tree.startswith("/"): tree = "/%s" %(tree,) self.mediaDevice = device self.methodstr = "file://" + tree - elif methodstr.startswith("hd://"): - self.methodstr = "file:///mnt/source" else: - self.methodstr = methodstr + self.methodstr = m def writeMethodstr(self, f): import urllib @@ -588,7 +594,7 @@ class Anaconda: partition = string.split(self._loaderMethodstr[pidx:pidx+didx], ':')[0] dir = self._loaderMethodstr[pidx+didx+1:] f.write("harddrive --partition=%s --dir=%s\n" % (partition, dir)) - elif self._loaderMethodstr.startswith('nfs:/') or self._loaderMethodstr.startswith('nfsiso:'): + elif self._loaderMethodstr.startswith('nfs:') or self._loaderMethodstr.startswith('nfsiso:'): (method, tmpmntpt) = string.split(self._loaderMethodstr, ':') # clean up extra '/' at front if tmpmntpt[1] == '/': diff --git a/yuminstall.py b/yuminstall.py index f4ba51da7..7de9b0963 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -445,12 +445,19 @@ class AnacondaYum(YumSorter): self.conf.cachedir = '/tmp/cache/' self.conf.metadata_expire = 0 + if self.anaconda.methodstr.startswith("nfs:"): + methodstr = "file:///mnt/source" + if not os.path.ismount("/mnt/source"): + isys.mount(self.anaconda.methodstr[4:], "/mnt/source", "nfs") + elif self.anaconda.methodstr.startswith("ftp:") or self.anaconda.methodstr.startswith("http:"): + methodstr = self.anaconda.methodstr + # set up logging to log to our logs ylog = logging.getLogger("yum") map(lambda x: ylog.addHandler(x), log.handlers) # add default repos - for (name, uri) in self.anaconda.id.instClass.getPackagePaths(self.anaconda.methodstr).items(): + for (name, uri) in self.anaconda.id.instClass.getPackagePaths(methodstr).items(): rid = name.replace(" ", "") repo = AnacondaYumRepo(uri, addon=False, repoid="anaconda-%s-%s" %(rid, productStamp), |