Hi All:
How is stage2= suppose to work? For the hdinstall.c in the patch,
if you give "anything" as stage2= then the installer looks for
/mnt/isodir/images/stage2.img to loopback mount, then still looks in the
user given iso directory. Kind of like an override for the stage2 on the
iso, as a bonus if you can't find stage2, backing out clears the flag,
and will look to the iso for stage2. At least you could have an install
tree, like a nfs install with a bit of work. Maybe an "boot.iso-2-usb
drive" could work now? (It does...)
I thought the whole idea of having stage2 available was to cut down on
memory usage. Any reason to copy stage2 to /tmp? for hd nfs cdrom
installs? didn't think so... then here is a patch...
Just some thoughts,
Jerry
diff -up loader2/cdinstall.c.orig loader2/cdinstall.c
--- loader2/cdinstall.c.orig 2008-03-19 19:15:36.000000000 -0500
+++ loader2/cdinstall.c 2008-03-20 22:44:46.000000000 -0500
@@ -279,8 +279,8 @@ char * setupCdrom(char * location, struc
/* if in rescue mode lets copy stage 2 into RAM so we can */
/* free up the CD drive and user can have it avaiable to */
/* aid system recovery. */
- if (FL_RESCUE(flags) && !FL_TEXT(flags) &&
- totalMemory() > 128000) {
+ if (FL_RESCUE(flags) ||
+ totalMemory() > 512000) {
rc = copyFile(stage2loc, "/tmp/stage2.img");
stage2img = "/tmp/stage2.img";
stage2inram = 1;
diff -up loader2/method.c.orig loader2/method.c
--- loader2/method.c.orig 2008-03-19 19:19:44.000000000 -0500
+++ loader2/method.c 2008-03-20 21:19:29.000000000 -0500
@@ -96,16 +96,19 @@ int mountLoopback(char *fsystem, char *m
if (doPwMount(fsystem, mntpoint, "squashfs", opts)) {
if (doPwMount(fsystem, mntpoint, "cramfs", opts)) {
if (doPwMount(fsystem, mntpoint, "vfat", opts)) {
- logMessage(ERROR, "failed to mount loopback device %s on %s as %s: %s",
- device, mntpoint, fsystem, strerror(errno));
- return LOADER_ERROR;
+ if (doPwMount(fsystem, mntpoint, "ext3", opts)) {
+ logMessage(ERROR, "failed to mount loopback %s on %s as %s: %s",
+ fsystem, device,
+ mntpoint, strerror(errno));
+ return LOADER_ERROR;
+ }
}
}
}
}
}
- logMessage(INFO, "mounted loopback device %s on %s as %s", mntpoint, device, fsystem);
+ logMessage(INFO, "mounted %s using %s on %s", fsystem, device, mntpoint);
return 0;
}
@@ -664,3 +667,4 @@ void setMethodFromCmdline(char * arg, st
}
free(dup);
}
+
diff -up loader2/hdinstall.c.orig loader2/hdinstall.c
--- loader2/hdinstall.c.orig 2008-03-19 19:33:29.000000000 -0500
+++ loader2/hdinstall.c 2008-03-20 23:44:52.000000000 -0500
@@ -61,13 +61,9 @@ static int loadHDImages(char * prefix, c
char * device, char * mntpoint,
char * location) {
int fd = 0, rc, idx, tmp;
- char *path, *target = NULL, *dest, *cdurl = NULL;
+ char *path, *target = NULL, *cdurl = NULL;
char *stg2list[] = {"stage2.img", "minstg2.img", NULL};
-
- if (totalMemory() < 128000)
- idx = 1;
- else
- idx = 0;
+ idx = 0;
/* Try to see if we're booted off of a CD with stage2. However,
* passing stage2= overrides this check.
@@ -92,23 +88,25 @@ static int loadHDImages(char * prefix, c
else
tmp = asprintf(&path, "%s/%s/images/%s", prefix, dir ? dir : "", target);
- logMessage(INFO, "Looking for hd stage2 image %s", path);
+ logMessage(INFO, "Looking for HD stage2 image %s", path);
if (!access(path, F_OK))
break;
logMessage(INFO, "%s does not exist: %s, trying next target", path, strerror(errno));
}
if (!target) {
- logMessage(ERROR, "failed to find hd stage 2 image%s: %s", path, strerror(errno));
+ logMessage(ERROR, "failed to find %s: %s", path, strerror(errno));
return 1;
}
- logMessage(INFO, "Found hd stage2, copying %s in RAM as stage2", path);
if ((fd = open(path, O_RDONLY)) < 0) {
logMessage(ERROR, "failed to open %s: %s", path, strerror(errno));
return 1;
- }
+ } else {
+ logMessage(INFO, "Found HD %s,", path);
+ mountStage2(path, mntpoint);
+ }
}
free(path);
@@ -125,25 +123,18 @@ static int loadHDImages(char * prefix, c
copyProductImg(path);
free(path);
- if (!cdurl) {
- dest = alloca(strlen(target) + 50);
- sprintf(dest,"/tmp/%s", target);
- rc = copyFileAndLoopbackMount(fd, dest, device, mntpoint);
- close(fd);
-
if (!verifyStamp(mntpoint)) {
char * buf;
fd = asprintf(&buf,
- _("The %s installation tree in that directory does "
+ _("The %s installation tree in that directory does "
"not seem to match your boot media."),
getProductName());
-
+
newtWinMessage(_("Error"), _("OK"), buf);
free(buf);
umountLoopback(mntpoint, device);
return 1;
}
- }
return rc;
}
@@ -151,7 +142,7 @@ static int loadHDImages(char * prefix, c
/* given a partition device and directory, tries to mount hd install image */
static char * setupIsoImages(char * device, char * dirName, char * location) {
int rc;
- char *url = NULL, *dirspec, *updpath;
+ char *url = NULL, *dirspec, *updpath, *stg2path;
char *path;
char *typetry[] = {"ext3", "ext2", "vfat", NULL};
char **type;
@@ -169,45 +160,48 @@ static char * setupIsoImages(char * devi
return NULL;
if (FL_STAGE2(flags)) {
- rc = asprintf(&dirspec, "/mnt/isodir%.*s", (int) (strrchr(dirName, '/') - dirName), dirName);
- rc = asprintf(&path, "/mnt/isodir%s", dirName);
+/* this is messed up stage2=/blah doesn't populate just triggers...
+* rc = asprintf(&dirspec, "/mnt/isodir%.*s", (int) (strrchr(dirName, '/') - dirName), dirName);
+*/
+ rc = asprintf(&dirspec, "/mnt/isodir/images" );
+ rc = asprintf(&path, "/mnt/isodir%s", dirName );
} else {
+
if (*dirName == '/')
rc = asprintf(&dirspec, "/mnt/isodir%s", dirName);
else
rc = asprintf(&dirspec, "/mnt/isodir/%s", dirName);
path = validIsoImages(dirspec, 0, 1);
- }
+ }
if (path) {
- logMessage(INFO, "Path to valid iso is %s", path);
+ logMessage(INFO, "dirspec is %s", dirspec);
+ logMessage(INFO, "path is %s", path);
rc = asprintf(&updpath, "%s/updates.img", dirspec);
- logMessage(INFO, "Looking for updates for HD in %s", updpath);
- copyUpdatesImg(updpath);
-
+ logMessage(INFO, "Looking for updates in %s", updpath);
+ copyUpdatesImg(updpath);
free(updpath);
- free(dirspec);
if (FL_STAGE2(flags)) {
- if (!copyFile(path, "/tmp/stage2.img")) {
- rc = mountStage2("/tmp/stage2.img", dirName);
- umount("/mnt/isodir");
- free(path);
+ rc = asprintf(&stg2path, "%s/stage2.img", dirspec);
+ logMessage(INFO, "Looking for %s on HD", stg2path);
+ if (!access(stg2path, F_OK)) {
+ rc = mountStage2(stg2path, dirName);
+ free(dirspec);
+ free(path);
if (rc) {
umountLoopback("/mnt/runtime", "/dev/loop0");
flags &= ~LOADER_FLAGS_STAGE2;
goto err;
} else {
- rc = asprintf(&url, "hd:%s:%s:/%s",
- strrchr(device, '/')+1,
+ rc = asprintf(&url, "hd:%s:%s:/%s", device,
*type, dirName ? dirName : ".");
return url;
}
- }
- else {
+ } else {
free(path);
umount("/mnt/isodir");
flags &= ~LOADER_FLAGS_STAGE2;
@@ -431,7 +425,7 @@ char * mountHardDrive(struct installMeth
}
logMessage(INFO, "partition %s selected", selpart);
-
+
url = setupIsoImages(selpart, dir, location);
if (!url) {
newtWinMessage(_("Error"), _("OK"),
@@ -602,3 +596,4 @@ int kickstartFromBD(char *kssrc) {
}
/* vim:set shiftwidth=4 softtabstop=4: */
+
diff -up loader2/nfsinstall.c.orig loader2/nfsinstall.c
--- loader2/nfsinstall.c.orig 2008-03-19 19:55:04.000000000 -0500
+++ loader2/nfsinstall.c 2008-03-20 21:46:40.000000000 -0500
@@ -212,16 +212,14 @@ char * mountNfsImage(struct installMetho
buf = strdup("/mnt/source/images/stage2.img");
}
- winStatus(70, 3, _("Retrieving"), "%s %s...", _("Retrieving"), buf);
- rc = copyFile(buf, "/tmp/stage2.img");
+ winStatus(70, 3, _("Mounting"), "%s %s...", _("Mounting"), buf);
+ rc = mountStage2(buf, stage2dir);
newtPopWindow();
-
+
free(stage2dir);
-
- if (!rc) {
+
+ if (!rc) {
logMessage(INFO, "can access %s", buf);
- rc = mountStage2("/tmp/stage2.img", stage2dir);
-
free(buf);
if (rc && rc == -1) {
@@ -260,8 +258,7 @@ char * mountNfsImage(struct installMetho
buf = strdup("/mnt/source/images/stage2.img");
}
- rc = copyFile(buf, "/tmp/stage2.img");
- rc = mountStage2("/tmp/stage2.img", stage2dir);
+ rc = mountStage2(buf, stage2dir);
free(buf);
free(stage2dir);
free(path);
@@ -276,8 +273,8 @@ char * mountNfsImage(struct installMetho
break;
}
}
- }
- }
+ }
+ }
} else {
newtWinMessage(_("Error"), _("OK"),
_("That directory could not be mounted from "
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list