summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xanaconda79
-rw-r--r--backend.py4
-rw-r--r--dispatch.py1
-rw-r--r--installclass.py19
-rw-r--r--installclasses/fedora.py6
-rw-r--r--installclasses/rhel.py3
-rw-r--r--instdata.py31
-rw-r--r--livecd.py4
-rw-r--r--rescue.py1
-rw-r--r--yuminstall.py4
10 files changed, 66 insertions, 86 deletions
diff --git a/anaconda b/anaconda
index 79a619a29..0e8f7b3df 100755
--- a/anaconda
+++ b/anaconda
@@ -461,7 +461,7 @@ class Anaconda:
self.intf = None
self.dir = None
self.id = None
- self.method = None
+ self._loaderMethodstr = None
self.methodstr = None
self.backend = None
self.rootPath = None
@@ -470,6 +470,7 @@ class Anaconda:
self.rescue_mount = True
self.rescue = False
self.updateSrc = None
+ self.mediaDevice = None
def setDispatch(self):
self.dispatch = dispatch.Dispatcher(self)
@@ -505,14 +506,64 @@ class Anaconda:
self.intf = InstallInterface()
- def setMethod(self, instClass):
- m = instClass.getMethod(self.methodstr)
- if m is not None:
- self.method = apply(m, (self.methodstr, self.rootPath, self.intf))
-
def setBackend(self, instClass):
b = instClass.getBackend(self.methodstr)
- self.backend = apply(b, (self.method, self.rootPath))
+ self.backend = apply(b, (self.rootPath,))
+
+ 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
+
+ if methodstr.startswith("nfs://"):
+ self.methodstr = "file:///" + methodstr[6:]
+ elif methodstr.startswith("nfsiso:/"):
+ self.methodstr = "file:///mnt/source2"
+ elif methodstr.startswith("cdrom://"):
+ (device, tree) = string.split(methodstr[8:], ":", 1)
+
+ if not tree.startswith("/"):
+ tree = "/%s" %(tree,)
+
+ self.mediaDevice = device
+ self.methodstr = "file://" + tree
+ else:
+ self.methodstr = methodstr
+
+ 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://'):
+ pidx = string.find(self._loaderMethodstr, '//') + 2
+ didx = string.find(self._loaderMethodstr[pidx:], '/')
+ 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:'):
+ (method, tmpmntpt) = string.split(self._loaderMethodstr, ':')
+ # clean up extra '/' at front
+ if tmpmntpt[1] == '/':
+ rawmntpt = tmpmntpt[1:]
+ else:
+ rawmntpt = tmpmntpt
+ mntpt = os.path.normpath(rawmntpt)
+
+ # find mntpt in /proc/mounts so we can get NFS server info
+ fproc = open("/proc/mounts", "r")
+ lines = fproc.readlines()
+ fproc.close()
+
+ for l in lines:
+ minfo = string.split(l)
+ if len(minfo) > 1 and minfo[1] == mntpt and minfo[0].find(":") != -1:
+ (srv, dir) = minfo[0].split(':')
+ f.write("nfs --server=%s --dir=%s\n" % (srv, dir))
+ break
if __name__ == "__main__":
anaconda = Anaconda()
@@ -597,7 +648,8 @@ if __name__ == "__main__":
if opts.method:
if opts.method[0] == '@':
expandFTPMethod(opts)
- anaconda.methodstr = opts.method
+
+ anaconda.setMethodstr(opts.method)
if opts.module:
for mod in opts.module:
@@ -845,17 +897,6 @@ if __name__ == "__main__":
if not flags.test and flags.setupFilesystems:
iutil.makeDriveDeviceNodes()
- # imports after setting up the path
- if anaconda.methodstr:
- anaconda.setMethod(instClass)
-
- if not anaconda.method:
- anaconda.intf.messageWindow(_("Unknown install method"),
- _("You have specified an install method "
- "which isn't supported by anaconda."))
- log.critical (_("unknown install method: %s"), opts.method)
- sys.exit(1)
-
anaconda.setBackend(instClass)
anaconda.id = instClass.installDataClass(anaconda, extraModules, anaconda.methodstr, opts.display_mode, anaconda.backend)
diff --git a/backend.py b/backend.py
index 9ec560b20..7632f0de6 100644
--- a/backend.py
+++ b/backend.py
@@ -31,12 +31,10 @@ log = logging.getLogger("anaconda")
class AnacondaBackend:
- def __init__(self, method, instPath):
+ def __init__(self, instPath):
"""Abstract backend class all backends should inherit from this
- @param method: Object of InstallMethod type
@param instPath: root path for the installation to occur"""
- self.method = method
self.instPath = instPath
self.instLog = None
self.modeText = ""
diff --git a/dispatch.py b/dispatch.py
index 4c991e40f..ac4b4a0f5 100644
--- a/dispatch.py
+++ b/dispatch.py
@@ -238,7 +238,6 @@ class Dispatcher(object):
self.step = None
self.skipSteps = {}
- self.method = anaconda.method
self.firstStep = 0
def _getDir(self):
diff --git a/installclass.py b/installclass.py
index d6a8806fa..74036c513 100644
--- a/installclass.py
+++ b/installclass.py
@@ -412,25 +412,6 @@ class BaseInstallClass(object):
mouse.set(mouseName, emulThree, device)
id.setMouse(mouse)
- def getMethod(self, methodstr):
- if methodstr.startswith('cdrom://'):
- from image import CdromInstallMethod
- return CdromInstallMethod
- elif methodstr.startswith('nfs:/'):
- from image import NfsInstallMethod
- return NfsInstallMethod
- elif methodstr.startswith('nfsiso:/'):
- from image import NfsIsoInstallMethod
- return NfsIsoInstallMethod
- elif methodstr.startswith('ftp://') or methodstr.startswith('http://'):
- from urlinstall import UrlInstallMethod
- return UrlInstallMethod
- elif methodstr.startswith('hd://'):
- from harddrive import HardDriveInstallMethod
- return HardDriveInstallMethod
- else:
- return None
-
def getBackend(self, methodstr):
# this should be overriden in distro install classes
from backend import AnacondaBackend
diff --git a/installclasses/fedora.py b/installclasses/fedora.py
index 696a78c48..6f035716d 100644
--- a/installclasses/fedora.py
+++ b/installclasses/fedora.py
@@ -43,12 +43,6 @@ class InstallClass(BaseInstallClass):
BaseInstallClass.setSteps(self, anaconda);
anaconda.dispatch.skipStep("partition")
- def getMethod(self, methodstr):
- if methodstr.startswith("livecd://"):
- import livecd
- return livecd.LiveCDImageMethod
- return BaseInstallClass.getMethod(self, methodstr)
-
def getBackend(self, methodstr):
if methodstr.startswith("livecd://"):
import livecd
diff --git a/installclasses/rhel.py b/installclasses/rhel.py
index b6e8cda8f..387443ecc 100644
--- a/installclasses/rhel.py
+++ b/installclasses/rhel.py
@@ -158,9 +158,6 @@ class InstallClass(BaseInstallClass):
log.info("repopaths is %s" %(self.repopaths,))
- def getMethod(self, methodstr):
- return BaseInstallClass.getMethod(self, methodstr)
-
def getBackend(self, methodstr):
return yuminstall.YumBackend
diff --git a/instdata.py b/instdata.py
index 784fdb65f..cdb0574b4 100644
--- a/instdata.py
+++ b/instdata.py
@@ -212,36 +212,7 @@ class InstallData:
f.write("install\n");
# figure out the install method and write out a line
- if self.methodstr.startswith('ftp://') or self.methodstr.startswith('http://'):
- f.write("url --url %s\n" % urllib.unquote(self.methodstr))
- elif self.methodstr.startswith('cdrom://'):
- f.write("cdrom\n")
- elif self.methodstr.startswith('hd://'):
- pidx = string.find(self.methodstr, '//') + 2
- didx = string.find(self.methodstr[pidx:], '/')
- partition = string.split(self.methodstr[pidx:pidx+didx], ':')[0]
- dir = self.methodstr[pidx+didx+1:]
- f.write("harddrive --partition=%s --dir=%s\n" % (partition, dir))
- elif self.methodstr.startswith('nfs:/') or self.methodstr.startswith('nfsiso:'):
- (method, tmpmntpt) = string.split(self.methodstr, ':')
- # clean up extra '/' at front
- if tmpmntpt[1] == '/':
- rawmntpt = tmpmntpt[1:]
- else:
- rawmntpt = tmpmntpt
- mntpt = os.path.normpath(rawmntpt)
-
- # find mntpt in /proc/mounts so we can get NFS server info
- fproc = open("/proc/mounts", "r")
- lines = fproc.readlines()
- fproc.close()
-
- for l in lines:
- minfo = string.split(l)
- if len(minfo) > 1 and minfo[1] == mntpt and minfo[0].find(":") != -1:
- (srv, dir) = minfo[0].split(':')
- f.write("nfs --server=%s --dir=%s\n" % (srv, dir))
- break
+ self.anaconda.writeMethodstr(f)
if self.instClass.skipkey:
f.write("key --skip\n")
diff --git a/livecd.py b/livecd.py
index d718bfee9..0e41e6086 100644
--- a/livecd.py
+++ b/livecd.py
@@ -141,8 +141,8 @@ class LiveCDImageMethod(installmethod.InstallMethod):
return blkcnt * blksize / 1024 / 1024
class LiveCDCopyBackend(backend.AnacondaBackend):
- def __init__(self, method, instPath):
- backend.AnacondaBackend.__init__(self, method, instPath)
+ def __init__(self, instPath):
+ backend.AnacondaBackend.__init__(self, instPath)
flags.livecdInstall = True
self.supportsUpgrades = False
self.supportsPackageSelection = False
diff --git a/rescue.py b/rescue.py
index 0c5a03961..9cb100390 100644
--- a/rescue.py
+++ b/rescue.py
@@ -276,7 +276,6 @@ def runRescue(anaconda, instClass):
screen = SnackScreen()
anaconda.intf = RescueInterface(screen)
- anaconda.setMethod(instClass)
# prompt to see if we should try and find root filesystem and mount
# everything in /etc/fstab on that root
diff --git a/yuminstall.py b/yuminstall.py
index a7a0758d8..67f6d661f 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -576,8 +576,8 @@ class AnacondaYum(YumSorter):
return False
class YumBackend(AnacondaBackend):
- def __init__ (self, method, instPath):
- AnacondaBackend.__init__(self, method, instPath)
+ def __init__ (self, instPath):
+ AnacondaBackend.__init__(self, instPath)
self.supportsPackageSelection = True
def doInitialSetup(self, anaconda):