--- anaconda | 62 ++++++--------------------------------------- installclass.py | 2 +- installclasses/fedora.py | 8 +++-- installclasses/rhel.py | 2 +- instdata.py | 10 ++----- 5 files changed, 19 insertions(+), 65 deletions(-) diff --git a/anaconda b/anaconda index d8dc855..94be9ad 100755 --- a/anaconda +++ b/anaconda @@ -478,7 +478,6 @@ class Anaconda: self.intf = None self.dir = None self.id = None - self._loaderMethodstr = None self.methodstr = None self.backend = None self.rootPath = None @@ -524,29 +523,12 @@ class Anaconda: self.intf = InstallInterface() def setBackend(self, instClass): - b = instClass.getBackend(self.methodstr) + b = instClass.getBackend() self.backend = apply(b, (self,)) def setMethodstr(self, methodstr): - # Save the method string we are given from the loader for printing out - # later. For dealing with the backends, we need to convert it into - # real URIs, though. - self._loaderMethodstr = methodstr - - # 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 methodstr.startswith("cdrom://"): + (device, tree) = string.split(methodstr[8:], ":", 1) if not tree.startswith("/"): tree = "/%s" %(tree,) @@ -554,23 +536,7 @@ class Anaconda: self.mediaDevice = device self.methodstr = "cdrom://%s" % tree else: - self.methodstr = m - - def writeMethodstr(self, f): - import urllib - - if self._loaderMethodstr.startswith('ftp://') or self._loaderMethodstr.startswith('http://'): - f.write("url --url %s\n" % urllib.unquote(self._loaderMethodstr)) - elif self._loaderMethodstr.startswith('cdrom://'): - f.write("cdrom\n") - elif self._loaderMethodstr.startswith('hd:'): - (partition, filesystem, dir) = string.split(self._loaderMethodstr[3:], ':') - if partition.startswith("/dev/"): - partition = partition[5:] - f.write("harddrive --partition=%s --dir=%s\n" % (partition, dir)) - elif self._loaderMethodstr.startswith('nfs:') or self._loaderMethodstr.startswith('nfsiso:'): - (method, server, dir) = string.split(self._loaderMethodstr, ':') - f.write("nfs --server=%s --dir=%s\n" % (server, dir)) + self.methodstr = methodstr if __name__ == "__main__": anaconda = Anaconda() @@ -655,12 +621,9 @@ if __name__ == "__main__": if opts.method[0] == '@': expandFTPMethod(opts) - # FIXME: this is terrible, but it gets the desired behavior without - # requiring scary loader changes at this point - if flags.cmdline.has_key("stage2") and flags.cmdline.has_key("method"): - opts.method = flags.cmdline["method"] - anaconda.setMethodstr(opts.method) + else: + anaconda.methodstr = None if opts.module: for mod in opts.module: @@ -764,15 +727,11 @@ if __name__ == "__main__": import rescue, instdata - anaconda.id = instdata.InstallData(anaconda, [], anaconda.methodstr, opts.display_mode) + anaconda.id = instdata.InstallData(anaconda, [], opts.display_mode) rescue.runRescue(anaconda, instClass) # shouldn't get back here sys.exit(1) - else: - if not anaconda.methodstr: - sys.stderr.write('no install method specified\n') - sys.exit(1) # # Here we have a hook to pull in second half of kickstart file via https @@ -794,9 +753,7 @@ if __name__ == "__main__": # if display_mode wasnt set by command line parameters then set default # if not opts.display_mode: - if (anaconda.methodstr and - anaconda.methodstr.startswith('ftp://') or - anaconda.methodstr.startswith('http://')): + if opts.stage2 and opts.stage2.find("minstg2.img") != -1: opts.display_mode = 't' else: opts.display_mode = 'g' @@ -812,7 +769,6 @@ if __name__ == "__main__": log.info("anaconda called with cmdline = %s" %(sys.argv,)) log.info("Display mode = %s" %(opts.display_mode,)) - log.info("Method = %s" %(anaconda.methodstr,)) checkMemory(opts) @@ -885,7 +841,7 @@ if __name__ == "__main__": anaconda.setBackend(instClass) - anaconda.id = instClass.installDataClass(anaconda, extraModules, anaconda.methodstr, opts.display_mode, anaconda.backend) + anaconda.id = instClass.installDataClass(anaconda, extraModules, opts.display_mode, anaconda.backend) anaconda.id.x_already_set = x_already_set diff --git a/installclass.py b/installclass.py index 414b5cf..ef1b262 100644 --- a/installclass.py +++ b/installclass.py @@ -181,7 +181,7 @@ class BaseInstallClass(object): grps = anaconda.backend.getDefaultGroups(anaconda) map(lambda x: anaconda.backend.selectGroup(x), grps) - def getBackend(self, methodstr): + def getBackend(self): # this should be overriden in distro install classes from backend import AnacondaBackend return AnacondaBackend diff --git a/installclasses/fedora.py b/installclasses/fedora.py index f140139..8bb3be7 100644 --- a/installclasses/fedora.py +++ b/installclasses/fedora.py @@ -19,6 +19,7 @@ from installclass import BaseInstallClass from constants import * +from flags import flags import os, types import iutil @@ -64,11 +65,12 @@ class InstallClass(BaseInstallClass): BaseInstallClass.setSteps(self, anaconda); anaconda.dispatch.skipStep("partition") - def getBackend(self, methodstr): - if methodstr.startswith("livecd://"): + def getBackend(self): + if flags.livecd: import livecd return livecd.LiveCDCopyBackend - return yuminstall.YumBackend + else: + return yuminstall.YumBackend def __init__(self, expert): BaseInstallClass.__init__(self, expert) diff --git a/installclasses/rhel.py b/installclasses/rhel.py index d1b00ee..98134bc 100644 --- a/installclasses/rhel.py +++ b/installclasses/rhel.py @@ -172,7 +172,7 @@ class InstallClass(BaseInstallClass): log.info("repopaths is %s" %(self.repopaths,)) - def getBackend(self, methodstr): + def getBackend(self): return yuminstall.YumBackend def __init__(self, expert): diff --git a/instdata.py b/instdata.py index 4b22e8a..227557a 100644 --- a/instdata.py +++ b/instdata.py @@ -98,8 +98,8 @@ class InstallData: stat.S_ISBLK(os.stat("/dev/live")[stat.ST_MODE]): target = os.readlink("/dev/live") self.partitions.protected = [target] - elif self.anaconda._loaderMethodstr.startswith("hd:"): - method = self.anaconda._loaderMethodstr[3:] + elif self.anaconda.methodstr and self.anaconda.methodstr.startswith("hd:"): + method = self.anaconda.methodstr[3:] device = method.split(":", 3)[0] if device.startswith("/dev/"): device = device[5:] @@ -222,9 +222,6 @@ class InstallData: else: f.write("install\n"); - # figure out the install method and write out a line - self.anaconda.writeMethodstr(f) - if self.instClass.skipkey: f.write("key --skip\n") elif self.instClass.installkey: @@ -275,7 +272,7 @@ class InstallData: os.chmod(filename, 0600) - def __init__(self, anaconda, extraModules, methodstr, displayMode, backend = None): + def __init__(self, anaconda, extraModules, displayMode, backend = None): self.displayMode = displayMode self.instLanguage = language.Language(self.displayMode) @@ -289,5 +286,4 @@ class InstallData: self.extraModules = extraModules self.fsset = fsset.FileSystemSet() - self.methodstr = methodstr self.reset() -- 1.5.5.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list