diff options
author | Jeremy Katz <katzj@redhat.com> | 2006-06-30 05:05:08 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2006-06-30 05:05:08 +0000 |
commit | d4ed4196e1bf43c7f8849183fa27c4de0f4e2b82 (patch) | |
tree | 6f7a98cbea6b093730496812ad3d6c613f308d73 /loader2 | |
parent | 2a7615304f4783c095ae7fa591ea0c20bc3e1aae (diff) | |
download | anaconda-d4ed4196e1bf43c7f8849183fa27c4de0f4e2b82.tar.gz anaconda-d4ed4196e1bf43c7f8849183fa27c4de0f4e2b82.tar.xz anaconda-d4ed4196e1bf43c7f8849183fa27c4de0f4e2b82.zip |
2006-06-30 Jeremy Katz <katzj@redhat.com>
* scripts/mk-images: Move second stage images to images/ dir.
* image.py: Adjust for stage2 in images/
* loader2/cdinstall.c: Likewise.
* loader2/hdinstall.c: Likewise.
* loader2/method.c: Likewise.
* loader2/nfsinstall.c: Likewise.
* loader2/urlinstall.c: Likewise.
Diffstat (limited to 'loader2')
-rw-r--r-- | loader2/cdinstall.c | 20 | ||||
-rw-r--r-- | loader2/hdinstall.c | 10 | ||||
-rw-r--r-- | loader2/method.c | 11 | ||||
-rw-r--r-- | loader2/nfsinstall.c | 20 | ||||
-rw-r--r-- | loader2/urlinstall.c | 24 |
5 files changed, 29 insertions, 56 deletions
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c index 502f0935d..79e256796 100644 --- a/loader2/cdinstall.c +++ b/loader2/cdinstall.c @@ -149,7 +149,6 @@ static void wrongCDMessage(void) { static void mountCdromStage2(char *cddev) { int gotcd1=0; int rc; - char path[1024]; devMakeInode(cddev, "/tmp/cdrom"); do { @@ -163,8 +162,7 @@ static void mountCdromStage2(char *cddev) { } } while (1); - snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); - rc = mountStage2(path); + rc = mountStage2("/mnt/source/images/stage2.img"); /* if we failed, umount /mnt/source and keep going */ if (rc) { @@ -316,12 +314,7 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData, devMakeInode(devices[i]->device, "/tmp/cdrom"); if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", IMOUNT_RDONLY, NULL)) { - char path[1024]; - - snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", - getProductPath()); - - if (!access(path, R_OK) && + if (!access("/mnt/source/images/stage2.img", R_OK) && (!requirepkgs || !access("/mnt/source/.discinfo", R_OK))) { /* if in rescue mode lets copy stage 2 into RAM so we can */ @@ -329,15 +322,12 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData, /* aid system recovery. */ if (FL_RESCUE(flags) && !FL_TEXT(flags) && totalMemory() > 128000) { - snprintf(path, sizeof(path), - "/mnt/source/%s/base/stage2.img", getProductPath()); - rc = copyFile(path, "/tmp/ramfs/stage2.img"); + rc = copyFile("/mnt/source/images/stage2.img", + "/tmp/ramfs/stage2.img"); stage2img = "/tmp/ramfs/stage2.img"; stage2inram = 1; } else { - snprintf(path, sizeof(path), - "/mnt/source/%s/base/stage2.img", getProductPath()); - stage2img = strdup(path); + stage2img = strdup("/mnt/source/images/stage2.img"); stage2inram = 0; } diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c index b8df57dbe..fe3864cf1 100644 --- a/loader2/hdinstall.c +++ b/loader2/hdinstall.c @@ -62,7 +62,7 @@ static int loadHDImages(char * prefix, char * dir, target = NULL; for (; stg2list[idx]; idx++) { target = stg2list[idx]; - sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target); + sprintf(path, "%s/%s/images/%s", prefix, dir ? dir : "", target); logMessage(INFO, "Looking for hd stage2 image %s", path); if (!access(path, F_OK)) @@ -84,12 +84,12 @@ static int loadHDImages(char * prefix, char * dir, /* 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/%s/base/updates.img", prefix, dir ? dir : "", getProductPath()); + sprintf(path, "%s/%s/images/updates.img", prefix, dir ? dir : ""); 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/%s/base/product.img", prefix, dir ? dir : "", getProductPath()); + sprintf(path, "%s/%s/images/product.img", prefix, dir ? dir : ""); copyProductImg(path); dest = alloca(strlen(target) + 50); @@ -125,7 +125,7 @@ static int mountHDImages(char * prefix, char * dir, target = NULL; for (idx=0; stg2list[idx]; idx++) { target = stg2list[idx]; - sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target); + sprintf(path, "%s/%s/images/%s", prefix, dir ? dir : "", target); logMessage(INFO, "Looking for hd stage2 image %s", path); if (!access(path, F_OK)) @@ -163,7 +163,7 @@ static int mountHDImages(char * prefix, char * dir, /* 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/%s/base/updates.img", prefix, dir ? dir : "", getProductPath()); + sprintf(path, "%s/%s/images/updates.img", prefix, dir ? dir : ""); copyUpdatesImg(path); return rc; diff --git a/loader2/method.c b/loader2/method.c index 48bb1efa3..404bd7d0f 100644 --- a/loader2/method.c +++ b/loader2/method.c @@ -150,7 +150,6 @@ char * validIsoImages(char * dirName, int *foundinvalid) { DIR * dir; struct dirent * ent; char isoImage[1024]; - char path[1024]; if (!(dir = opendir(dirName))) { newtWinMessage(_("Error"), _("OK"), @@ -175,8 +174,7 @@ char * validIsoImages(char * dirName, int *foundinvalid) { continue; } - snprintf(path, sizeof(path), "/tmp/loopimage/%s/base/stage2.img", getProductPath()); - if (mountLoopback(path, "/mnt/runtime", "loop0")) { + if (mountLoopback("/tmp/loopimage/images/stage2.img", "/mnt/runtime", "loop0")) { umountLoopback("/mnt/runtime", "loop0"); } else { if (verifyStamp("/mnt/runtime")) { @@ -589,7 +587,6 @@ 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; } @@ -604,12 +601,10 @@ int mountStage2(char * path) { } /* JKFIXME: this is kind of silly.. /mnt/source is hardcoded :/ */ - snprintf(imgPath, sizeof(imgPath), "/mnt/source/%s/base/updates.img", getProductPath()); - copyUpdatesImg(imgPath); + copyUpdatesImg("/mnt/source/images/updates.img"); /* more hard coding */ - snprintf(imgPath, sizeof(imgPath), "/mnt/source/%s/base/product.img", getProductPath()); - copyProductImg(imgPath); + copyProductImg("/mnt/source/images/product.img"); return 0; } diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c index 2bd3bf635..415e75729 100644 --- a/loader2/nfsinstall.c +++ b/loader2/nfsinstall.c @@ -151,12 +151,9 @@ char * mountNfsImage(struct installMethod * method, if (!doPwMount(fullPath, "/mnt/source", "nfs", IMOUNT_RDONLY, mountOpts)) { - char mntPath[1024]; - - snprintf(mntPath, sizeof(mntPath), "/mnt/source/%s/base/stage2.img", getProductPath()); - if (!access(mntPath, R_OK)) { - logMessage(INFO, "can access %s", mntPath); - rc = mountStage2(mntPath); + if (!access("/mnt/source/images/stage2.img", R_OK)) { + logMessage(INFO, "can access /mnt/source/images/stage2.img"); + rc = mountStage2("/mnt/source/images/stage2.img"); logMessage(DEBUGLVL, "after mountStage2, rc is %d", rc); if (rc) { if (rc == -1) { @@ -169,7 +166,7 @@ char * mountNfsImage(struct installMethod * method, break; } } else { - logMessage(WARNING, "unable to access %s", mntPath); + logMessage(WARNING, "unable to access /mnt/source/images/stage2.img"); } if ((path = validIsoImages("/mnt/source", &foundinvalid))) { @@ -180,8 +177,7 @@ char * mountNfsImage(struct installMethod * method, if (mountLoopback(path, "/mnt/source2", "loop1")) logMessage(WARNING, "failed to mount iso %s loopback", path); else { - snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/stage2.img", getProductPath()); - rc = mountStage2(mntPath); + rc = mountStage2("/mnt/source2/images/stage2.img"); if (rc) { umountLoopback("/mnt/source2", "loop1"); if (rc == -1) @@ -189,10 +185,8 @@ char * mountNfsImage(struct installMethod * method, } else { /* JKFIXME: hack because /mnt/source is hard-coded * in mountStage2() */ - 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); + copyUpdatesImg("/mnt/source2/images/updates.img"); + copyProductImg("/mnt/source2/images/product.img"); queryIsoMediaCheck(path); diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c index 11dfb994b..504925592 100644 --- a/loader2/urlinstall.c +++ b/loader2/urlinstall.c @@ -43,20 +43,14 @@ extern int flags; static int loadSingleUrlImage(struct iurlinfo * ui, char * file, char * dest, char * mntpoint, char * device, - int silentErrors, int addProduct) { + int silentErrors) { int fd; int rc = 0; char * newFile = NULL; char filepath[1024]; char *ehdrs = NULL; - /* Not all callers want product/<foo>, most notably getting the repomd.xml - * file (see comment below about hardcoding backend knowledge). - */ - if (addProduct == 1) - snprintf(filepath, sizeof(filepath), "%s/%s", getProductPath(), file); - else - snprintf(filepath, sizeof(filepath), "%s", file); + snprintf(filepath, sizeof(filepath), "%s", file); if (ui->protocol == URL_METHOD_HTTP) { ehdrs = (char *) malloc(24+strlen(VERSION)); @@ -117,9 +111,9 @@ static int loadUrlImages(struct iurlinfo * ui) { /* grab the updates.img before netstg1.img so that we minimize our * ramdisk usage */ - if (!loadSingleUrlImage(ui, "base/updates.img", + if (!loadSingleUrlImage(ui, "images/updates.img", "/tmp/ramfs/updates-disk.img", "/tmp/update-disk", - "loop7", 1, 1)) { + "loop7", 1)) { copyDirectory("/tmp/update-disk", "/tmp/updates"); umountLoopback("/tmp/update-disk", "loop7"); unlink("/tmp/ramfs/updates-disk.img"); @@ -128,9 +122,9 @@ static int loadUrlImages(struct iurlinfo * ui) { /* grab the product.img before netstg1.img so that we minimize our * ramdisk usage */ - if (!loadSingleUrlImage(ui, "base/product.img", + if (!loadSingleUrlImage(ui, "images/product.img", "/tmp/ramfs/product-disk.img", "/tmp/product-disk", - "loop7", 1, 1)) { + "loop7", 1)) { copyDirectory("/tmp/product-disk", "/tmp/product"); umountLoopback("/tmp/product-disk", "loop7"); unlink("/tmp/ramfs/product-disk.img"); @@ -147,11 +141,11 @@ static int loadUrlImages(struct iurlinfo * ui) { stage2img = "stage2.img"; } - snprintf(tmpstr1, sizeof(tmpstr1), "base/%s", stage2img); + snprintf(tmpstr1, sizeof(tmpstr1), "images/%s", stage2img); snprintf(tmpstr2, sizeof(tmpstr2), "/tmp/ramfs/%s", stage2img); rc = loadSingleUrlImage(ui, tmpstr1, tmpstr2, - "/mnt/runtime", "loop0", 0, 1); + "/mnt/runtime", "loop0", 0); if (rc) { if (rc != 2) newtWinMessage(_("Error"), _("OK"), @@ -292,7 +286,7 @@ char * mountUrlImage(struct installMethod * method, which sucks */ if (cdurl && (loadSingleUrlImage(&ui, "repodata/repomd.xml", NULL, - NULL, NULL, 0, 0) == 0)) { + NULL, NULL, 0) == 0)) { logMessage(INFO, "Detected stage 2 image on CD"); winStatus(50, 3, _("Media Detected"), _("Local installation media detected..."), 0); |