diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-07-24 05:34:53 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-07-24 05:34:53 +0000 |
commit | ab6116821b6dc3b47471e830b4df87c23ca3a41a (patch) | |
tree | ad7eb6068d5f8dbd0142a5de509b7feee2a7b4d6 | |
parent | 63cfd194686954a38b6681f474aabf6111181efe (diff) | |
download | anaconda-ab6116821b6dc3b47471e830b4df87c23ca3a41a.tar.gz anaconda-ab6116821b6dc3b47471e830b4df87c23ca3a41a.tar.xz anaconda-ab6116821b6dc3b47471e830b4df87c23ca3a41a.zip |
fix cd installs (based on msf's comments). also, add stuff to copy RedHat/base/comps.rpm into /var/tmp before we start installing packages and actually install it after the install. there's got to be a better way, but this will at least work for this beta
-rw-r--r-- | harddrive.py | 12 | ||||
-rw-r--r-- | image.py | 29 | ||||
-rw-r--r-- | packages.py | 31 | ||||
-rw-r--r-- | urlinstall.py | 24 |
4 files changed, 85 insertions, 11 deletions
diff --git a/harddrive.py b/harddrive.py index 7e072c9ae..50d4cb408 100644 --- a/harddrive.py +++ b/harddrive.py @@ -26,6 +26,12 @@ FILENAME = 1000000 # Install from a set of files laid out on the hard drive like a CD class OldHardDriveInstallMethod(InstallMethod): + def copyFileToTemp(self, filename): + tmppath = self.getTempPath() + path = tmppath + os.path.basename(filename) + shutil.copy(self.tree + "/" + filename, path) + + return path def mountMedia(self): if (self.isMounted): @@ -105,6 +111,12 @@ class OldHardDriveInstallMethod(InstallMethod): # Install from one or more iso images class HardDriveInstallMethod(InstallMethod): + def copyFileToTemp(self, filename): + tmppath = self.getTempPath() + path = tmppath + os.path.basename(tmppath) + shutil.copy(self.tree + "/" + filename, path) + + return path # mounts disc image cdNum under self.tree def mountMedia(self, cdNum): @@ -43,6 +43,13 @@ class ImageInstallMethod(InstallMethod): def getSourcePath(self): return self.tree + def copyFileToTemp(self, filename): + tmppath = self.getTempPath() + path = tmppath + os.path.basename(filename) + shutil.copy(self.tree + "/" + filename, path) + + return path + def __init__(self, tree, rootPath): InstallMethod.__init__(self, rootPath) self.tree = tree @@ -93,7 +100,7 @@ class CdromInstallMethod(ImageInstallMethod): timer.stop() f = open("/mnt/source/.discinfo") - timestamp = f.readline() + timestamp = f.readline().strip() f.close() self.currentDisc = h[1000002] @@ -113,17 +120,17 @@ class CdromInstallMethod(ImageInstallMethod): readOnly = 1): if os.access("/mnt/source/.discinfo", os.O_RDONLY): f = open("/mnt/source/.discinfo") - newStamp = f.readline() + newStamp = f.readline().strip() try: - descr = f.readline() + descr = f.readline().strip() except: descr = None try: - arch = f.readline() + arch = f.readline().strip() except: arch = None try: - discNum = string.atoi(f.readline()) + discNum = string.atoi(f.readline().strip()) except: discNum = 0 f.close() @@ -157,17 +164,17 @@ class CdromInstallMethod(ImageInstallMethod): if os.access("/mnt/source/.discinfo", os.O_RDONLY): f = open("/mnt/source/.discinfo") - newStamp = f.readline() + newStamp = f.readline().strip() try: - descr = f.readline() + descr = f.readline().strip() except: descr = None try: - arch = f.readline() + arch = f.readline().strip() except: arch = None try: - discNum = string.atoi(f.readline()) + discNum = string.atoi(f.readline().strip()) except: discNum = 0 f.close() @@ -210,6 +217,7 @@ class CdromInstallMethod(ImageInstallMethod): os.remove(fullName) def filesDone(self): + isys.umount("/mnt/source") if not self.loopbackFile: return try: @@ -217,6 +225,7 @@ class CdromInstallMethod(ImageInstallMethod): os.unlink(self.loopbackFile) except SystemError: pass + def __init__(self, url, messageWindow, progressWindow, rootPath): (self.device, tree) = string.split(url, "/", 1) @@ -258,7 +267,7 @@ def findIsoImages(path, messageWindow): f.readline() # skip timestamp f.readline() # skip release description discArch = string.strip(f.readline()) # read architecture - discNum = string.atoi(f.readline()) # read disc number + discNum = string.atoi(f.readline().strip()) # read disc number except: discArch = None discNum = 0 diff --git a/packages.py b/packages.py index b319dd8f1..a2ba6ceaa 100644 --- a/packages.py +++ b/packages.py @@ -550,6 +550,13 @@ def doPreInstall(method, id, intf, instPath, dir): "Press the OK button to reboot your system.")) sys.exit(0) + # try to copy the comps package. if it doesn't work, don't worry about it + try: + id.compspkg = method.copyFileToTemp("RedHat/base/comps.rpm") + except: + log("Unable to copy comps package") + id.compspkg = None + # write out the fstab if not upgrade: id.fsset.write(instPath) @@ -774,7 +781,7 @@ def doPostInstall(method, id, intf, instPath): return w = intf.progressWindow(_("Post Install"), - _("Performing post install configuration..."), 5) + _("Performing post install configuration..."), 6) upgrade = id.upgrade.get() arch = iutil.getArch () @@ -888,6 +895,28 @@ def doPostInstall(method, id, intf, instPath): w.set(5) + # FIXME: hack to install the comps package + if (id.compspkg is not None and + os.access(id.compspkg, os.R_OK)): + try: + # ugly hack + path = id.compspkg.split("/mnt/sysimage")[1] + args = ["/bin/rpm", "-Uvh", path] + rc = iutil.execWithRedirect(args[0], args, + stdout = "/dev/tty5", + stderr = "/dev/tty5", + root = instPath) + os.unlink(id.compspkg) + except: + log("failed to install comps.rpm. oh well") + try: + os.unlink(id.compspkg) + except: + pass + + w.set(6) + + finally: pass diff --git a/urlinstall.py b/urlinstall.py index 5851e5014..2957bbe5a 100644 --- a/urlinstall.py +++ b/urlinstall.py @@ -68,6 +68,30 @@ class UrlInstallMethod(InstallMethod): return file + def copyFileToTemp(self, filename): + tmppath = self.getTempPath() + + if self.multiDics: + base = "%s/disc1" % (self.pkgUrl,) + else: + base = self.pkgUrl + fullPath = base + filename + + file = tmppath + os.path.basename(fullPath) + + connected = 0 + while not connected: + try: + urllib.urlretrieve(fullPath, file) + except IOError, (errnum, msg): + log("IOError %s occurred getting %s: %s", + errnum, fullPath, str(msg)) + time.sleep(5) + else: + connected = 1 + + return file + def unlinkFilename(self, fullName): os.remove(fullName) |