From 3f7e6fbc27c88a18c32c3d7fddb1259a6e51bd89 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 12 Jul 2002 03:06:57 +0000 Subject: apply pbrown's patch to change disc info files to be .discinfo and have all of the relevant information. this will allow for similar formatting for other product CDs such as the lacd --- image.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 14 deletions(-) (limited to 'image.py') diff --git a/image.py b/image.py index c9df8099d..73b3ec514 100644 --- a/image.py +++ b/image.py @@ -91,8 +91,7 @@ class CdromInstallMethod(ImageInstallMethod): elif h[1000002] != self.currentDisc: timer.stop() - key = ".disc%d-%s" % (self.currentDisc, iutil.getArch()) - f = open("/mnt/source/" + key) + f = open("/mnt/source/.discinfo") timestamp = f.readline() f.close() @@ -100,7 +99,6 @@ class CdromInstallMethod(ImageInstallMethod): isys.umount("/mnt/source") done = 0 - key = "/mnt/source/.disc%d-%s" % (self.currentDisc, iutil.getArch()) cdlist = [] for (dev, something, descript) in \ @@ -112,11 +110,25 @@ class CdromInstallMethod(ImageInstallMethod): try: if not isys.mount(dev, "/mnt/source", fstype = "iso9660", readOnly = 1): - if os.access(key, os.O_RDONLY): - f = open(key) + if os.access("/mnt/source/.discinfo", os.O_RDONLY): + f = open("/mnt/source/.discinfo") newStamp = f.readline() + try: + descr = f.readline() + except: + descr = None + try: + arch = f.readline() + except: + arch = None + try: + discNum = string.atoi(f.readline()) + except: + discNum = 0 f.close() - if newStamp == timestamp: + if (newStamp == timestamp and + arch == iutil.getArch() and + discNum == self.currentDisc): done = 1 if not done: @@ -127,9 +139,6 @@ class CdromInstallMethod(ImageInstallMethod): if done: break - if done: - break - if not done: isys.ejectCdrom(self.device) @@ -144,11 +153,26 @@ class CdromInstallMethod(ImageInstallMethod): isys.mount(self.device, "/mnt/source", fstype = "iso9660", readOnly = 1) - if os.access(key, os.O_RDONLY): - f = open(key) + + if os.access("/mnt/source/.discinfo", os.O_RDONLY): + f = open("/mnt/source/.discinfo") newStamp = f.readline() + try: + descr = f.readline() + except: + descr = None + try: + arch = f.readline() + except: + arch = None + try: + discNum = string.atoi(f.readline()) + except: + discNum = 0 f.close() - if newStamp == timestamp: + if (newStamp == timestamp and + arch == iutil.getArch() and + discNum == self.currentDisc): done = 1 # make /tmp/cdrom again so cd gets ejected isys.makeDevInode(self.device, "/tmp/cdrom") @@ -226,8 +250,19 @@ def findIsoImages(path, messageWindow): isys.mount("loop2", "/mnt/cdimage", fstype = "iso9660", readOnly = 1) for num in range(1, 10): - discTag = "/mnt/cdimage/.disc%d-%s" % (num, arch) - if os.access(discTag, os.R_OK): + if os.access("/mnt/cdimage/.discinfo", os.R_OK): + f = open("/mnt/cdimage/.discinfo"); + try: + f.readline() # skip timestamp + f.readline() # skip release description + discArch = f.readline() # read architecture + discNum = string.atoi(f.readline()) # read disc number + except: + discArch = None + discNum = 0 + if discNum != num or discArch != arch: + continue + import stat # warn user if images appears to be wrong size -- cgit