diff options
-rw-r--r-- | image.py | 63 | ||||
-rw-r--r-- | loader/loader.c | 13 | ||||
-rwxr-xr-x | scripts/splitdistro | 18 |
3 files changed, 64 insertions, 30 deletions
@@ -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 diff --git a/loader/loader.c b/loader/loader.c index 0e76a4502..ac4627370 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -832,8 +832,8 @@ char *getReleaseDescriptorFromIso(char *file) { errno = 0; stampfile = NULL; while ((ent = readdir(dir))) { - if (!strncmp(ent->d_name, ".disc", 4)) { - stampfile = strdup(ent->d_name); + if (!strncmp(ent->d_name, ".discinfo", 9)) { + stampfile = strdup(".discinfo"); break; } } @@ -846,17 +846,14 @@ char *getReleaseDescriptorFromIso(char *file) { if (f) { char *tmpptr; + /* skip over time stamp line */ tmpptr = fgets(tmpstr, sizeof(tmpstr), f); + /* now read OS description line */ if (tmpptr) tmpptr = fgets(tmpstr, sizeof(tmpstr), f); fclose(f); - - if (tmpptr >= 0 && strlen(tmpstr) > 0) { - for (ptr = tmpstr+strlen(tmpstr) - 1; - ptr != tmpstr && isspace(*ptr); ptr--); - *(ptr+1) = '\0'; + if (tmpptr) descr = tmpstr; - } } } diff --git a/scripts/splitdistro b/scripts/splitdistro index fce4718bc..cff6f5d34 100755 --- a/scripts/splitdistro +++ b/scripts/splitdistro @@ -22,10 +22,12 @@ import getopt import time import types -def stamp(path, releasestr, name, arch, startedAt): - f = open("%s/.%s-%s" % (path, name, arch), "w") +def stamp(path, releasestr, num, arch, startedAt): + f = open("%s/.discinfo" % path, "w") f.write("%f\n" % startedAt) - f.write("%s %s\n" % (releasestr, name)) + f.write("%s\n" % releasestr) + f.write("%s\n" % arch) + f.write("%s\n" % name) f.close() def moveFiles(srcDir, destDir, files): @@ -182,10 +184,10 @@ os.system("mkdir -p %s %s %s/SRPMS %s/RedHat/RPMS %s/RedHat/RPMS %s/SRPMS" % print "Creating disc1..." os.system("cp -al %s/. %s" % (distDir, disc1Dir)) -stamp(disc1Dir, releasestr, "disc1", arch, startedAt) +stamp(disc1Dir, releasestr, "1", arch, startedAt) print "Creating disc2..." -stamp(disc2Dir, releasestr, "disc2", arch, startedAt) +stamp(disc2Dir, releasestr, "2", arch, startedAt) for file in jointfiles: linkFile(disc1Dir, disc2Dir, file) @@ -199,7 +201,7 @@ moveFiles("%s/RedHat/RPMS" % disc1Dir, disc1Size = spaceUsed(disc1Dir) print "Creating disc3..." -stamp(disc3Dir, releasestr, "disc3", arch, startedAt) +stamp(disc3Dir, releasestr, "3", arch, startedAt) for file in jointfiles: linkFile(disc1Dir, disc2Dir, file) @@ -216,7 +218,7 @@ print "Creating first source disc..." os.system("cp -al %s/. %s" % (srcDir, disc1SrcDir)) print "Creating second source disc..." -stamp(disc2SrcDir, releasestr, "disc4", arch, startedAt) +stamp(disc2SrcDir, releasestr, "4", arch, startedAt) srcPkgList = os.listdir("%s/SRPMS" % disc1SrcDir) srcPkgList.sort() @@ -228,7 +230,7 @@ moveFiles("%s/SRPMS" % disc1SrcDir, srcDisc1Size = spaceUsed(disc1SrcDir) print "Dropping remainder of sources on third disc..." -stamp(disc2SrcDir, releasestr, "disc5", arch, startedAt) +stamp(disc2SrcDir, releasestr, "5", arch, startedAt) disc3pkgs = excessFiles(srcDir + "/SRPMS", srcPkgList, srcDisc1Size - disc3used + targetSize - fudgeFactor) moveFiles("%s/SRPMS" % disc2SrcDir, |