summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xanaconda37
-rw-r--r--installclass.py24
-rw-r--r--installclasses/fedora.py9
-rw-r--r--installclasses/rhel.py6
4 files changed, 50 insertions, 26 deletions
diff --git a/anaconda b/anaconda
index 77026b99f..8c688553f 100755
--- a/anaconda
+++ b/anaconda
@@ -15,7 +15,7 @@
#
# ... And many others
#
-# Copyright 1999-2006 Red Hat, Inc.
+# Copyright 1999-2007 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
@@ -526,24 +526,14 @@ class Anaconda:
self.intf = InstallInterface()
- def setMethod(self):
- if self.methodstr.startswith('cdrom://'):
- from image import CdromInstallMethod
- self.method = CdromInstallMethod(self.methodstr, self.rootPath, self.intf)
- elif self.methodstr.startswith('nfs:/'):
- from image import NfsInstallMethod
- self.method = NfsInstallMethod(self.methodstr, self.rootPath, self.intf)
- elif self.methodstr.startswith('nfsiso:/'):
- from image import NfsIsoInstallMethod
- self.method = NfsIsoInstallMethod(self.methodstr, self.rootPath, self.intf)
- elif self.methodstr.startswith('ftp://') or self.methodstr.startswith('http://'):
- from urlinstall import UrlInstallMethod
- self.method = UrlInstallMethod(self.methodstr, self.rootPath, self.intf)
- elif self.methodstr.startswith('hd://'):
- from harddrive import HardDriveInstallMethod
- self.method = HardDriveInstallMethod(self.methodstr, self.rootPath, self.intf)
- else:
- self.method = None
+ 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.methodstr, self.rootPath))
if __name__ == "__main__":
anaconda = Anaconda()
@@ -627,12 +617,8 @@ if __name__ == "__main__":
anaconda.updateSrc = opts.updateSrc
if opts.method:
- anaconda.methodstr = opts.method
-
- if opts.method:
if opts.method[0] == '@':
expandFTPMethod(opts)
-
anaconda.methodstr = opts.method
if opts.module:
@@ -869,7 +855,7 @@ if __name__ == "__main__":
# imports after setting up the path
if anaconda.methodstr:
- anaconda.setMethod()
+ anaconda.setMethod(instClass)
if not anaconda.method:
anaconda.intf.messageWindow(_("Unknown install method"),
@@ -878,8 +864,7 @@ if __name__ == "__main__":
log.critical (_("unknown install method: %s"), opts.method)
sys.exit(1)
- from yuminstall import YumBackend
- anaconda.backend = YumBackend(anaconda.method, anaconda.rootPath)
+ anaconda.setBackend(instClass)
# create device nodes for detected devices if we're not running in test mode
if not flags.test and flags.setupFilesystems:
diff --git a/installclass.py b/installclass.py
index 0503e9516..dcb41bb60 100644
--- a/installclass.py
+++ b/installclass.py
@@ -406,6 +406,30 @@ class BaseInstallClass:
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
+ return AnacondaBackend
+
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX,
doClear = 1):
autorequests = [ ("/", None, 1024, None, 1, 1, 1) ]
diff --git a/installclasses/fedora.py b/installclasses/fedora.py
index 1ed820ff0..d069dc338 100644
--- a/installclasses/fedora.py
+++ b/installclasses/fedora.py
@@ -4,6 +4,9 @@ from constants import *
import os
import iutil
+import installmethod
+import yuminstall
+
import rpmUtils.arch
class InstallClass(BaseInstallClass):
@@ -41,5 +44,11 @@ class InstallClass(BaseInstallClass):
BaseInstallClass.setSteps(self, dispatch);
dispatch.skipStep("partition")
+ def getMethod(self, methodstr):
+ return BaseInstallClass.getMethod(self, methodstr)
+
+ def getBackend(self, methodstr):
+ return yuminstall.YumBackend
+
def __init__(self, expert):
BaseInstallClass.__init__(self, expert)
diff --git a/installclasses/rhel.py b/installclasses/rhel.py
index 411382299..4f89031c6 100644
--- a/installclasses/rhel.py
+++ b/installclasses/rhel.py
@@ -91,6 +91,12 @@ class InstallClass(BaseInstallClass):
self.regkey = key
+ def getMethod(self, methodstr):
+ return BaseInstallClass.getMethod(self, methodstr)
+
+ def getBackend(self, methodstr):
+ return yuminstall.YumBackend
+
def __init__(self, expert):
BaseInstallClass.__init__(self, expert)