diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-06-25 19:27:03 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-06-25 19:27:03 +0000 |
commit | dc44a06b95c25dd3dad62ebb2aae0290f279fb46 (patch) | |
tree | abb6c9cb69b11488f8eec1c86ce8bebcbf9458b5 | |
parent | 631bacf0193b8a65eaec81043b1b03bfa329cc95 (diff) | |
download | anaconda-dc44a06b95c25dd3dad62ebb2aae0290f279fb46.tar.gz anaconda-dc44a06b95c25dd3dad62ebb2aae0290f279fb46.tar.xz anaconda-dc44a06b95c25dd3dad62ebb2aae0290f279fb46.zip |
get the root path into all of the install methods
-rwxr-xr-x | anaconda | 11 | ||||
-rw-r--r-- | harddrive.py | 8 | ||||
-rw-r--r-- | image.py | 16 | ||||
-rw-r--r-- | installmethod.py | 18 | ||||
-rw-r--r-- | urlinstall.py | 13 |
5 files changed, 38 insertions, 28 deletions
@@ -576,13 +576,13 @@ if method: if method.startswith('cdrom://'): from image import CdromInstallMethod method = CdromInstallMethod(method[8:], intf.messageWindow, - intf.progressWindow) + intf.progressWindow, rootPath) elif method.startswith('nfs:/'): from image import NfsInstallMethod - method = NfsInstallMethod(method[5:]) + method = NfsInstallMethod(method[5:], rootPath) elif method.startswith('nfsiso:/'): from image import NfsIsoInstallMethod - method = NfsIsoInstallMethod(method[8:], intf.messageWindow) + method = NfsIsoInstallMethod(method[8:], intf.messageWindow, rootPath) elif method.startswith('ftp://') or method.startswith('http://'): from urlinstall import UrlInstallMethod method = UrlInstallMethod(method, rootPath) @@ -598,7 +598,8 @@ if method: dir = method[i+1:] from harddrive import HardDriveInstallMethod - method = HardDriveInstallMethod(drive, type, dir, intf.messageWindow) + method = HardDriveInstallMethod(drive, type, dir, intf.messageWindow, + rootPath) elif method.startswith('oldhd://'): method = method[8:] @@ -611,7 +612,7 @@ if method: dir = method[i+1:] from harddrive import OldHardDriveInstallMethod - method = OldHardDriveInstallMethod(drive, type, dir) + method = OldHardDriveInstallMethod(drive, type, dir, rootPath) else: print "unknown install method:", method sys.exit(1) diff --git a/harddrive.py b/harddrive.py index 5875b040c..326a4fbae 100644 --- a/harddrive.py +++ b/harddrive.py @@ -95,8 +95,8 @@ class OldHardDriveInstallMethod(InstallMethod): rc.append(self.device) return rc - def __init__(self, device, type, path): - InstallMethod.__init__(self) + def __init__(self, device, type, path, rootPath): + InstallMethod.__init__(self, rootPath) self.device = device self.path = path self.fstype = type @@ -207,8 +207,8 @@ class HardDriveInstallMethod(InstallMethod): rc.append(self.device) return rc - def __init__(self, device, type, path, messageWindow): - InstallMethod.__init__(self) + def __init__(self, device, type, path, messageWindow, rootPath): + InstallMethod.__init__(self, rootPath) self.device = device self.path = path self.fstype = type @@ -41,8 +41,8 @@ class ImageInstallMethod(InstallMethod): def getSourcePath(self): return self.tree - def __init__(self, tree): - InstallMethod.__init__(self) + def __init__(self, tree, rootPath): + InstallMethod.__init__(self, rootPath) self.tree = tree class CdromInstallMethod(ImageInstallMethod): @@ -175,18 +175,18 @@ class CdromInstallMethod(ImageInstallMethod): except SystemError: pass - def __init__(self, url, messageWindow, progressWindow): + def __init__(self, url, messageWindow, progressWindow, rootPath): (self.device, tree) = string.split(url, "/", 1) self.messageWindow = messageWindow self.progressWindow = progressWindow self.currentDisc = 1 self.loopbackFile = None - ImageInstallMethod.__init__(self, "/" + tree) + ImageInstallMethod.__init__(self, "/" + tree, rootPath) class NfsInstallMethod(ImageInstallMethod): - def __init__(self, tree): - ImageInstallMethod.__init__(self, tree) + def __init__(self, tree, rootPath): + ImageInstallMethod.__init__(self, tree, rootPath) def findIsoImages(path, messageWindow): files = os.listdir(path) @@ -269,7 +269,7 @@ class NfsIsoInstallMethod(NfsInstallMethod): def filesDone(self): self.umountImage() - def __init__(self, tree, messageWindow): + def __init__(self, tree, messageWindow, rootPath): self.imageMounted = None self.isoPath = tree @@ -281,5 +281,5 @@ class NfsIsoInstallMethod(NfsInstallMethod): self.discImages = findIsoImages(tree, messageWindow) self.mountImage(1) - ImageInstallMethod.__init__(self, self.mntPoint) + ImageInstallMethod.__init__(self, self.mntPoint, rootPath) diff --git a/installmethod.py b/installmethod.py index 1b49fbf2b..c1096c9d0 100644 --- a/installmethod.py +++ b/installmethod.py @@ -26,6 +26,21 @@ class InstallMethod: return self.readCompsViaMethod(hdlist) pass + def getTempPath(self): + root = self.rootPath + pathlist = [ "/var/tmp", "/tmp", + "/." ] + tmppath = None + for p in pathlist: + if (os.access(root + p, os.X_OK)): + tmppath = root + p + "/" + break + + if tmppath is None: + raise RuntimeError, "Unable to find temp path" + + return tmppath + def getFilename(self, h, timer): pass @@ -44,7 +59,8 @@ class InstallMethod: def unlinkFilename(self, fullName): pass - def __init__(self): + def __init__(self, rootpath): + self.rootPath = rootpath pass def getSourcePath(self): diff --git a/urlinstall.py b/urlinstall.py index 3578d3b47..5558037da 100644 --- a/urlinstall.py +++ b/urlinstall.py @@ -40,14 +40,8 @@ class UrlInstallMethod(InstallMethod): return ComponentSet(self.baseUrl + '/RedHat/base/comps', hdlist) def getFilename(self, h, timer): - root = self.rootPath - pathlist = [ "/var/tmp", "/tmp", - "/." ] - for p in pathlist: - if (os.access(root + p, os.X_OK)): - tmppath = root + p + "/" - break - + tmppath = self.getTempPath() + # h doubles as a filename -- gross if type("/") == type(h): fullPath = self.baseUrl + "/" + h @@ -114,8 +108,7 @@ class UrlInstallMethod(InstallMethod): os.unlink(fn) def __init__(self, url, rootPath): - InstallMethod.__init__(self) - self.rootPath = rootPath + InstallMethod.__init__(self, rootPath) i = string.index(url, '://') + 2 self.baseUrl = url[0:i] |