From 60a8f9866e39b0eb0f5f0e15057f36679d007522 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Tue, 14 Oct 2003 19:36:32 +0000 Subject: read product path from the build stamp if possible, default to RedHat if not available. basically notting's patch with some fixes and genhdlist handled --- constants.py | 1 + findpackageset.py | 4 +-- harddrive.py | 11 ++++---- hdrlist.py | 12 +++++---- image.py | 21 ++++++++------- installmethod.py | 4 +-- loader2/cdinstall.c | 15 ++++++++--- loader2/hdinstall.c | 10 +++---- loader2/loader.c | 63 ++++++++++++++++++++++++++++++--------------- loader2/loader.h | 2 +- loader2/method.c | 11 +++++--- loader2/nfsinstall.c | 16 ++++++++---- loader2/urlinstall.c | 16 +++++++----- packages.py | 2 +- product.py | 3 +++ scripts/buildinstall | 33 ++++++++++++++---------- scripts/mk-images | 9 +++++-- scripts/mk-rescueimage.i386 | 11 +++++--- scripts/pkgorder | 13 +++++++--- scripts/splittree.py | 28 +++++++++++--------- urlinstall.py | 9 ++++--- utils/genhdlist.c | 20 +++++++------- 22 files changed, 195 insertions(+), 119 deletions(-) diff --git a/constants.py b/constants.py index 73865b1cc..88df39970 100644 --- a/constants.py +++ b/constants.py @@ -65,6 +65,7 @@ FIRSTBOOT_RECONFIG = 2 import product productName = product.productName productVersion = product.productVersion +productPath = product.productPath exceptionText = N_("An unhandled exception has occurred. This " "is most likely a bug. Please copy the " diff --git a/findpackageset.py b/findpackageset.py index f4e402e10..063c98c05 100644 --- a/findpackageset.py +++ b/findpackageset.py @@ -1,5 +1,5 @@ import rpm - +from constants import * # set DB_PRIVATE to make rpm happy rpm.addMacro("__dbi_cdb", "create private mpool mp_mmapsize=16Mb mp_size=1Mb") @@ -105,7 +105,7 @@ if __name__ == "__main__": else: instPath = "/" - fd = os.open("%s/RedHat/base/hdlist" %(tree,), os.O_RDONLY) + fd = os.open("%s/%s/base/hdlist" %(tree, productPath), os.O_RDONLY) hdlist = rpm.readHeaderListFromFD(fd) os.close(fd) diff --git a/harddrive.py b/harddrive.py index 92c3f8bb1..dfa020d8e 100644 --- a/harddrive.py +++ b/harddrive.py @@ -24,6 +24,7 @@ import rpm import string from rhpl.translate import _, cat, N_ from rhpl.log import log +from constants import * FILENAME = 1000000 @@ -138,14 +139,14 @@ class HardDriveInstallMethod(InstallMethod): self.umountMedia() self.mountMedia(h[1000002]) - return self.tree + "/RedHat/RPMS/" + h[1000000] + return "%s/%s/RPMS/%s" % (self.tree, productPath, h[1000000]) def readHeaders(self): self.mountMedia(1) - if not os.access(self.tree + "/RedHat/base/hdlist", os.R_OK): + if not os.access("%s/%s/base/hdlist" % (self.tree, productPath), os.R_OK): self.umountMedia() raise FileCopyException - hl = HeaderListFromFile(self.tree + "/RedHat/base/hdlist") + hl = HeaderListFromFile("%s/%s/base/hdlist" % (self.tree, productPath)) self.umountMedia() # Make sure all of the correct CD images are available @@ -169,10 +170,10 @@ class HardDriveInstallMethod(InstallMethod): def mergeFullHeaders(self, hdlist): self.mountMedia(1) - if not os.access(self.tree + "/RedHat/base/hdlist", os.R_OK): + if not os.access("%s/%s/base/hdlist" % (self.tree, productPath), os.R_OK): self.umountMedia() raise FileCopyException - hdlist.mergeFullHeaders(self.tree + "/RedHat/base/hdlist2") + hdlist.mergeFullHeaders("%s/%s/base/hdlist2" % (self.tree, productPath)) self.umountMedia() def systemMounted(self, fsset, mntPoint): diff --git a/hdrlist.py b/hdrlist.py index f4625927a..73c993e9c 100644 --- a/hdrlist.py +++ b/hdrlist.py @@ -25,6 +25,8 @@ from rhpl.translate import _, N_ import rhpl.comps import rhpl.arch +from constants import * + import language ON = 1 @@ -997,8 +999,8 @@ if __name__ == "__main__": if (what == rpm.RPMCALLBACK_INST_OPEN_FILE): print "Installing %s" %(nevra(h),) - rpmfd = os.open("%s/RedHat/RPMS/%s-%s-%s.%s.rpm" - %(tree, h['name'], h['version'], h['release'], + rpmfd = os.open("%s/%s/RPMS/%s-%s-%s.%s.rpm" + %(tree, productPath, h['name'], h['version'], h['release'], h['arch']), os.O_RDONLY) return rpmfd elif (what == rpm.RPMCALLBACK_INST_PROGRESS): @@ -1023,7 +1025,7 @@ if __name__ == "__main__": return 0 - fd = os.open(tree + "/RedHat/base/hdlist", os.O_RDONLY) + fd = os.open("%s/%s/base/hdlist" % (tree, productPath), os.O_RDONLY) hdrs = rpm.readHeaderListFromFD(fd) os.close(fd) showMem() @@ -1031,12 +1033,12 @@ if __name__ == "__main__": # rpm.mergeHeaderListFromFD(hdrs, fd, 1000004) # os.close(fd) showMem() - f = open(tree + "/RedHat/base/comps.xml", "r") + f = open("%s/%s/base/comps.xml" % (tree, productPath), "r") comps = rhpl.comps.Comps(f) f.close() showMem() hdrlist = HeaderList(hdrs) - hdrlist.mergeFullHeaders(tree + "/RedHat/base/hdlist2") + hdrlist.mergeFullHeaders("%s/%s/base/hdlist2" % (tree, productPath)) showMem() groups = GroupSet(comps, hdrlist) showMem() diff --git a/image.py b/image.py index 22c95c19a..7ab6f2a43 100644 --- a/image.py +++ b/image.py @@ -88,18 +88,18 @@ class ImageInstallMethod(InstallMethod): if self.currentIso is not None and self.currentIso != h[1000002]: log("switching from iso %s to %s for %s-%s-%s.%s" %(self.currentIso, h[1000002], h['name'], h['version'], h['release'], h['arch'])) self.currentIso = h[1000002] - return self.getFilename("/RedHat/RPMS/" + h[1000000], callback=callback) + return self.getFilename("/%s/RPMS/%s" % (productPath, h[1000000]), callback=callback) def readHeaders(self): - if not os.access(self.tree + "/RedHat/base/hdlist", os.R_OK): + if not os.access("%s/%s/base/hdlist" % (self.tree, productPath), os.R_OK): raise FileCopyException - hl = HeaderListFromFile(self.tree + "/RedHat/base/hdlist") + hl = HeaderListFromFile("%s/%s/base/hdlist" % (self.tree, productPath)) return hl def mergeFullHeaders(self, hdlist): - if not os.access(self.tree + "/RedHat/base/hdlist2", os.R_OK): + if not os.access("%s/%s/base/hdlist2" % (self.tree, productPath), os.R_OK): raise FileCopyException - hdlist.mergeFullHeaders(self.tree + "/RedHat/base/hdlist2") + hdlist.mergeFullHeaders("%s/%s/base/hdlist2" % (self.tree, productPath)) def getSourcePath(self): return self.tree @@ -149,7 +149,7 @@ class CdromInstallMethod(ImageInstallMethod): if self.loopbackFile: isys.makeDevInode("loop0", "/tmp/loop") isys.lochangefd("/tmp/loop", - "%s/RedHat/base/stage2.img" % self.tree) + "%s/%s/base/stage2.img" % (self.tree, productPath)) self.loopbackFile = None def systemMounted(self, fsset, chroot): @@ -158,7 +158,7 @@ class CdromInstallMethod(ImageInstallMethod): "/rhinstall-stage2.img") try: - iutil.copyFile("%s/RedHat/base/stage2.img" % self.tree, + iutil.copyFile("%s/%s/base/stage2.img" % (self.tree, productPath), self.loopbackFile, (self.progressWindow, _("Copying File"), _("Transferring install image to hard drive..."))) @@ -316,7 +316,8 @@ class CdromInstallMethod(ImageInstallMethod): # FIXME: should retry a few times then prompt for new cd while tries < 5: try: - shutil.copy(self.tree + "/RedHat/RPMS/" + h[1000000], + shutil.copy("%s/%s/RPMS/%s" % (self.tree, productPath, + h[1000000]), tmppath + h[1000000]) except IOError, (errnum, msg): log("IOError %s occurred copying %s: %s", @@ -429,7 +430,7 @@ def findIsoImages(path, messageWindow): # if it's disc1, it needs to have RedHat/base/stage2.img if (num == 1 and not - os.access("/mnt/cdimage/RedHat/base/stage2.img", + os.access("/mnt/cdimage/%s/base/stage2.img" % (productPath,), os.R_OK)): continue @@ -466,7 +467,7 @@ class NfsIsoInstallMethod(NfsInstallMethod): self.umountImage() self.mountImage(h[1000002]) - return self.getFilename("/RedHat/RPMS/" + h[1000000]) + return self.getFilename("/%s/RPMS/%s" % (productPath, h[1000000])) def readHeaders(self): hl = NfsInstallMethod.readHeaders(self) diff --git a/installmethod.py b/installmethod.py index 354ef1eb9..f55343c89 100644 --- a/installmethod.py +++ b/installmethod.py @@ -30,8 +30,8 @@ class InstallMethod: rc = None tryloc = ["/tmp/updates"] if treebase is not None: - tryloc.append(treebase + "/RHupdates") - tryloc.append(treebase + "/RedHat/base") + tryloc.append("%s/RHupdates" %(treebase,)) + tryloc.append("%s/%s/base" % (treebase, productPath)) for pre in tryloc: tmpname = pre + "/" + file diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c index 5344ffe69..3e2231029 100644 --- a/loader2/cdinstall.c +++ b/loader2/cdinstall.c @@ -147,6 +147,7 @@ static void wrongCDMessage(void) { static void mountCdromStage2(char *cddev) { int gotcd1=0; int rc; + char path[1024]; devMakeInode(cddev, "/tmp/cdrom"); do { @@ -160,7 +161,8 @@ static void mountCdromStage2(char *cddev) { } } while (1); - rc = mountStage2("/mnt/source/RedHat/base/stage2.img"); + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + rc = mountStage2(path); /* if we failed, umount /mnt/source and keep going */ if (rc) { @@ -318,7 +320,10 @@ char * setupCdrom(char * location, devMakeInode(kd->known[i].name, "/tmp/cdrom"); if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", 1, 0, NULL, NULL, 0, 0)) { - if (!access("/mnt/source/RedHat/base/stage2.img", R_OK) && + char path[1024]; + + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + if (!access(path, R_OK) && (!requirepkgs || !access("/mnt/source/.discinfo", R_OK))) { @@ -326,11 +331,13 @@ char * setupCdrom(char * location, /* free up the CD drive and user can have it avaiable to */ /* aid system recovery. */ if (FL_RESCUE(flags) && totalMemory() > 128000) { - rc = copyFile("/mnt/source/RedHat/base/stage2.img", "/tmp/ramfs/stage2.img"); + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + rc = copyFile(path, "/tmp/ramfs/stage2.img"); stage2img = "/tmp/ramfs/stage2.img"; stage2inram = 1; } else { - stage2img = "/mnt/source/RedHat/base/stage2.img"; + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + stage2img = strdup(path); stage2inram = 0; } diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c index 08e399905..ad1d93a46 100644 --- a/loader2/hdinstall.c +++ b/loader2/hdinstall.c @@ -197,7 +197,7 @@ static int loadHDImages(char * prefix, char * dir, int flags, target = NULL; for (; stg2list[idx]; idx++) { target = stg2list[idx]; - sprintf(path, "%s/%s/RedHat/base/%s", prefix, dir ? dir : "", target); + sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target); logMessage("Looking for hd stage2 image %s", path); if (!access(path, F_OK)) @@ -221,12 +221,12 @@ static int loadHDImages(char * prefix, char * dir, int flags, /* handle updates.img now before we copy stage2 over... this allows * us to keep our ramdisk size as small as possible */ - sprintf(path, "%s/%s/RedHat/base/updates.img", prefix, dir ? dir : ""); + sprintf(path, "%s/%s/%s/base/updates.img", prefix, dir ? dir : "", getProductPath()); copyUpdatesImg(path); /* handle product.img now before we copy stage2 over... this allows * us to keep our ramdisk size as small as possible */ - sprintf(path, "%s/%s/RedHat/base/product.img", prefix, dir ? dir : ""); + sprintf(path, "%s/%s/%s/base/product.img", prefix, dir ? dir : "", getProductPath()); copyProductImg(path); dest = alloca(strlen(target) + 50); @@ -262,7 +262,7 @@ static int mountHDImages(char * prefix, char * dir, int flags, target = NULL; for (idx=0; stg2list[idx]; idx++) { target = stg2list[idx]; - sprintf(path, "%s/%s/RedHat/base/%s", prefix, dir ? dir : "", target); + sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target); logMessage("Looking for hd stage2 image %s", path); if (!access(path, F_OK)) @@ -302,7 +302,7 @@ static int mountHDImages(char * prefix, char * dir, int flags, /* handle updates.img now before we copy stage2 over... this allows * us to keep our ramdisk size as small as possible */ - sprintf(path, "%s/%s/RedHat/base/updates.img", prefix, dir ? dir : ""); + sprintf(path, "%s/%s/%s/base/updates.img", prefix, dir ? dir : "", getProductPath()); copyUpdatesImg(path); return rc; diff --git a/loader2/loader.c b/loader2/loader.c index b5aafa4e8..d3086a8ba 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -183,35 +183,56 @@ void stopNewt(void) { newtRunning = 0; } -char * getProductName(void) { - static char * productName = NULL; +static char * productName = NULL; +static char * productPath = NULL; + +static void initProductInfo(void) { FILE *f; int i; - if (!productName) { - f = fopen("/.buildstamp", "r"); - if (!f) { - productName = strdup("anaconda"); - } else { - productName = malloc(256); - fgets(productName, 256, f); /* stamp time */ - fgets(productName, 256, f); /* product name */ - - i = strlen(productName) - 1; - while (isspace(*(productName + i))) { - *(productName + i) = '\0'; - i--; - } - - return productName; - } + f = fopen("/.buildstamp", "r"); + if (!f) { + productName = strdup("anaconda"); + productPath = strdup("RedHat"); } else { - return productName; + productName = malloc(256); + productPath = malloc(256); + fgets(productName, 256, f); /* stamp time */ + fgets(productName, 256, f); /* product name */ + fgets(productPath, 256, f); /* product version */ + fgets(productPath, 256, f); /* product path */ + + i = strlen(productName) - 1; + while (isspace(*(productName + i))) { + *(productName + i) = '\0'; + i--; + } + i = strlen(productPath) - 1; + while (isspace(*(productPath + i))) { + *(productPath + i) = '\0'; + i--; + } } +} - return NULL; +char * getProductName(void) { + if (!productName) { + initProductInfo(); + } + return productName; +} + +char * getProductPath(void) { + if (!productPath) { + initProductInfo(); + } + return productPath; } + + + + void initializeConsole(moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags) { if (!FL_NOFB(flags)) diff --git a/loader2/loader.h b/loader2/loader.h index e0f524078..711a969a5 100644 --- a/loader2/loader.h +++ b/loader2/loader.h @@ -65,7 +65,7 @@ void startNewt(int flags); void stopNewt(); char * getProductName(void); - +char * getProductPath(void); #include "modules.h" #include "moduledeps.h" diff --git a/loader2/method.c b/loader2/method.c index 0a9694462..faa85ae89 100644 --- a/loader2/method.c +++ b/loader2/method.c @@ -143,6 +143,7 @@ char * validIsoImages(char * dirName) { DIR * dir; struct dirent * ent; char isoImage[1024]; + char path[1024]; if (!(dir = opendir(dirName))) { newtWinMessage(_("Error"), _("OK"), @@ -167,7 +168,8 @@ char * validIsoImages(char * dirName) { continue; } - if (!access("/tmp/loopimage/RedHat/base/hdstg2.img", F_OK)) { + snprintf(path, sizeof(path), "/tmp/loopimage/%s/base/hdstg2.img", getProductPath()); + if (!access(path, F_OK)) { umountLoopback("/tmp/loopimage", "loop7"); break; } @@ -570,6 +572,7 @@ void umountStage2(void) { /* mount a second stage, verify the stamp file, copy updates * Returns 0 on success, 1 on failure to mount, -1 on bad stamp */ int mountStage2(char * path) { + char imgPath[1024]; if (access(path, R_OK)) { return 1; } @@ -584,10 +587,12 @@ int mountStage2(char * path) { } /* JKFIXME: this is kind of silly.. /mnt/source is hardcoded :/ */ - copyUpdatesImg("/mnt/source/RedHat/base/updates.img"); + snprintf(imgPath, sizeof(imgPath), "/mnt/source/%s/base/updates.img", getProductPath()); + copyUpdatesImg(imgPath); /* more hard coding */ - copyProductImg("/mnt/source/RedHat/base/product.img"); + snprintf(imgPath, sizeof(imgPath), "/mnt/source/%s/base/product.img", getProductPath()); + copyProductImg(imgPath); return 0; } diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c index 4f8e9ff5c..80e8ea1e5 100644 --- a/loader2/nfsinstall.c +++ b/loader2/nfsinstall.c @@ -132,10 +132,13 @@ char * mountNfsImage(struct installMethod * method, stage = NFS_STAGE_NFS; if (!doPwMount(fullPath, "/mnt/source", "nfs", 1, 0, NULL, NULL, 0, 0)) { + char mntPath[1024]; + logMessage("mounted %s on /mnt/source", fullPath); - if (!access("/mnt/source/RedHat/base/stage2.img", R_OK)) { + snprintf(mntPath, sizeof(mntPath), "/mnt/source/%s/base/stage2.img", getProductPath()); + if (!access(mntPath, R_OK)) { logMessage("can access stage2.img"); - rc = mountStage2("/mnt/source/RedHat/base/stage2.img"); + rc = mountStage2(mntPath); logMessage("after mountStage2, rc is %d", rc); if (rc) { if (rc == -1) { @@ -156,7 +159,8 @@ char * mountNfsImage(struct installMethod * method, if (mountLoopback(path, "/mnt/source2", "loop1")) logMessage("failed to mount iso %s loopback", path); else { - rc = mountStage2("/mnt/source2/RedHat/base/stage2.img"); + snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/stage2.img", getProductPath()); + rc = mountStage2(mntPath); if (rc) { umountLoopback("/mnt/source2", "loop1"); if (rc == -1) @@ -164,8 +168,10 @@ char * mountNfsImage(struct installMethod * method, } else { /* JKFIXME: hack because /mnt/source is hard-coded * in mountStage2() */ - copyUpdatesImg("/mnt/source2/RedHat/base/updates.img"); - copyProductImg("/mnt/source2/RedHat/base/product.img"); + snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/updates.img", getProductPath()); + copyUpdatesImg(mntPath); + snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/product.img", getProductPath()); + copyProductImg(mntPath); queryIsoMediaCheck(path, flags); diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c index d19766dc5..480e32c74 100644 --- a/loader2/urlinstall.c +++ b/loader2/urlinstall.c @@ -43,8 +43,12 @@ static int loadSingleUrlImage(struct iurlinfo * ui, char * file, int flags, int fd; int rc; char * newFile = NULL; + char filepath[1024]; + + /* BNFIXME: hack - all callers want RedHat/, so add prefix here */ + snprintf(filepath, sizeof(filepath), "%s/%s", getProductPath(), file); - fd = urlinstStartTransfer(ui, file, NULL, 1, flags); + fd = urlinstStartTransfer(ui, filepath, NULL, 1, flags); if (fd == -2) return 2; @@ -52,7 +56,7 @@ static int loadSingleUrlImage(struct iurlinfo * ui, char * file, int flags, /* file not found */ newFile = alloca(strlen(device) + 20); - sprintf(newFile, "disc1/%s", file); + sprintf(newFile, "disc1/%s", filepath); fd = urlinstStartTransfer(ui, newFile, NULL, 1, flags); @@ -63,7 +67,7 @@ static int loadSingleUrlImage(struct iurlinfo * ui, char * file, int flags, _("Unable to retrieve %s://%s/%s/%s."), (ui->protocol == URL_METHOD_FTP ? "ftp" : "http"), - ui->address, ui->prefix, file); + ui->address, ui->prefix, filepath); return 2; } } @@ -92,7 +96,7 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) { /* grab the updates.img before netstg1.img so that we minimize our * ramdisk usage */ - if (!loadSingleUrlImage(ui, "RedHat/base/updates.img", flags, + if (!loadSingleUrlImage(ui, "base/updates.img", flags, "/tmp/ramfs/updates-disk.img", "/tmp/update-disk", "loop7", 1)) { copyDirectory("/tmp/update-disk", "/tmp/updates"); @@ -103,7 +107,7 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) { /* grab the product.img before netstg1.img so that we minimize our * ramdisk usage */ - if (!loadSingleUrlImage(ui, "RedHat/base/product.img", flags, + if (!loadSingleUrlImage(ui, "base/product.img", flags, "/tmp/ramfs/product-disk.img", "/tmp/product-disk", "loop7", 1)) { copyDirectory("/tmp/product-disk", "/tmp/product"); @@ -122,7 +126,7 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) { stage2img = "stage2.img"; } - snprintf(tmpstr1, sizeof(tmpstr1), "RedHat/base/%s", stage2img); + snprintf(tmpstr1, sizeof(tmpstr1), "base/%s", stage2img); snprintf(tmpstr2, sizeof(tmpstr2), "/tmp/ramfs/%s", stage2img); rc = loadSingleUrlImage(ui, tmpstr1, flags, tmpstr2, diff --git a/packages.py b/packages.py index 4ec77435b..86675d1d3 100644 --- a/packages.py +++ b/packages.py @@ -705,7 +705,7 @@ def doPreInstall(method, id, intf, instPath, dir): # 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") + id.compspkg = method.copyFileToTemp("%s/base/comps.rpm" % (productPath,)) except: log("Unable to copy comps package") id.compspkg = None diff --git a/product.py b/product.py index 334b32d14..aa66d9f0c 100644 --- a/product.py +++ b/product.py @@ -22,14 +22,17 @@ else: if path is None: productName = "anaconda" productVersion = "bluesky" + productPath = "RedHat" else: f = open(path, "r") lines = f.readlines() if len(lines) < 3: productName = "anaconda" productVersion = "bluesky" + productPath = "RedHat" else: productName = lines[1][:-1] productVersion = lines[2][:-1] + productPath = lines[3][:-1] diff --git a/scripts/buildinstall b/scripts/buildinstall index fbfb9d6cd..a92ba26a6 100755 --- a/scripts/buildinstall +++ b/scripts/buildinstall @@ -1,12 +1,13 @@ #!/bin/bash usage() { - echo "Usage: buildinstall [--comp ] [--pkgorder ] [--version ] [--product ] [--release ] " >&2 + echo "Usage: buildinstall [--comp ] [--pkgorder ] [--version ] [--product ] [--release ] [--prodpath ] " >&2 exit 1 } COMPNAME=dist-7.0 RUN=1 +PRODUCTPATH="RedHat" while [ $# -gt 0 ]; do case $1 in @@ -31,6 +32,10 @@ while [ $# -gt 0 ]; do PRODUCTSTR=$2 shift; shift ;; + --prodpath) + PRODUCTPATH=$2 + shift; shift + ;; --debug) DEBUGSTR="--debug" shift @@ -44,7 +49,7 @@ while [ $# -gt 0 ]; do shift; shift ;; *) - if [ -n "$DIR" -o ! -d $1/RedHat/RPMS ]; then + if [ -n "$DIR" -o ! -d $1/$PRODUCTPATH/RPMS ]; then usage fi DIR=$1 @@ -58,7 +63,7 @@ if [ -z "$PRODUCTSTR" ]; then fi if [ -z "$VERSION" ]; then - VERSION=$(rpm --qf '%{VERSION}' -qp $DIR/RedHat/RPMS/redhat-release-*.rpm) + VERSION=$(rpm --qf '%{VERSION}' -qp $DIR/$PRODUCTPATH/RPMS/redhat-release-*.rpm) fi if [ -z "$DIR" ]; then @@ -83,13 +88,13 @@ MK_IMAGES=$BUILDINSTDIR/mk-images MK_STAMP=$BUILDINSTDIR/makestamp.py BUILDINSTALL=$BUILDINSTDIR/buildinstall -BUILDARCH=`rpm -qp --qf "%{ARCH}" $p/RedHat/RPMS/anaconda-runtime-[0-9]*` +BUILDARCH=`rpm -qp --qf "%{ARCH}" $p/$PRODUCTPATH/RPMS/anaconda-runtime-[0-9]*` firstRun() { echo "Running buildinstall..." pushd $BUILDINSTDIR -rpm2cpio $p/RedHat/RPMS/anaconda-runtime-[0-9]* | cpio --quiet -iumd './usr*' +rpm2cpio $p/$PRODUCTPATH/RPMS/anaconda-runtime-[0-9]* | cpio --quiet -iumd './usr*' popd UPD_INSTROOT=./upd-instroot @@ -115,9 +120,9 @@ rm -rf $BUILDINSTDIR/usr echo "Going to run buildinstall again" # run it again for the second half if [ -x /usr/bin/runroot ]; then - runroot $COMPNAME --onlyone --arch $BUILDARCH "$BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release '\"$RELEASESTR\"' --product '\"$PRODUCTSTR\"' $DIR" + runroot $COMPNAME --onlyone --arch $BUILDARCH "$BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release '\"$RELEASESTR\"' --product '\"$PRODUCTSTR\"' --prodpath $PRODUCTPATH $DIR" else - $BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release \"$RELEASESTR\" --product \"$PRODUCTSTR\" $DIR + $BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release \"$RELEASESTR\" --product \"$PRODUCTSTR\" --prodpath $PRODUCTPATH $DIR fi rm -rf $BUILDINSTDIR @@ -126,30 +131,30 @@ rm -rf $BUILDINSTDIR secondRun() { echo "Building images..." if [ -x /usr/bin/runroot ]; then - runroot $COMPNAME --onlyone --arch $BUILDARCH "$UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/RedHat/RPMS $TREEDIR/image-template $TREEDIR/instimage" + runroot $COMPNAME --onlyone --arch $BUILDARCH "$UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/$PRODUCTPATH/RPMS $TREEDIR/image-template $TREEDIR/instimage" else - $UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/RedHat/RPMS $TREEDIR/image-template $TREEDIR/instimage + $UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/$PRODUCTPATH/RPMS $TREEDIR/image-template $TREEDIR/instimage fi if [ -n "$PKGORDER" ]; then echo "Getting package order..." if [ -x /usr/bin/runroot ]; then runroot --quiet $COMPNAME --onlyone --arch $BUILDARCH \ - "PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH" > $PKGORDER + "PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH $PRODUCTPATH" > $PKGORDER else - PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH > $PKGORDER + PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH $PRODUCTPATH > $PKGORDER fi fi echo "Making images..." if [ -x /usr/bin/runroot ]; then - runroot $COMPNAME --onlyone --arch $BUILDARCH "cd $BUILDINSTDIR\; ./mk-images $DEBUGSTR $p/RedHat/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH '\"$PRODUCTSTR\"' $VERSION" + runroot $COMPNAME --onlyone --arch $BUILDARCH "cd $BUILDINSTDIR\; ./mk-images $DEBUGSTR $p/$PRODUCTPATH/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH '\"$PRODUCTSTR\"' $VERSION $PRODUCTPATH" else - $MK_IMAGES $DEBUGSTR $p/RedHat/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH "$PRODUCTSTR" $VERSION + $MK_IMAGES $DEBUGSTR $p/$PRODUCTPATH/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH "$PRODUCTSTR" $VERSION $PRODUCTPATH fi echo "Writing .discinfo file" -$MK_STAMP --releasestr="$RELEASESTR" --arch=$BUILDARCH --discNum="1,2,3" --baseDir=RedHat/base --packagesDir=RedHat/RPMS --pixmapsDir=RedHat/pixmaps --outfile=$p/.discinfo +$MK_STAMP --releasestr="$RELEASESTR" --arch=$BUILDARCH --discNum="1,2,3" --baseDir=$PRODUCTPATH/base --packagesDir=$PRODUCTPATH/RPMS --pixmapsDir=$PRODUCTPATH/pixmaps --outfile=$p/.discinfo if [ -x /usr/bin/runroot ]; then runroot $COMPNAME --onlyone --arch $BUILDARCH "rm -rf $TREEDIR/image-template $TREEDIR/instimage" diff --git a/scripts/mk-images b/scripts/mk-images index e9c0dd0e6..e38aa4c86 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -4,7 +4,7 @@ PATH=$PATH:/sbin:/usr/sbin IMAGEUUID=$(date +%Y%m%d%H%M) usage () { - echo "usage: mk-images