Jerry Vonau wrote:
Jerry Vonau wrote:
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,
Well rather than break everything, I'll just break what I was playing
around with. ;-) For the boot prompt, I added a sting input in the form
of stg2= that goes where I was trying to use stage2= as a string. Well I
wonder if rescue mode works... be back later.
Jerry
Well that broke network stuff, this one is better. This one includes the
previous patch with some changes to nfsintall.c (bz438377) and dropping
of the cdinstall.c patch.
Jerry
--- loader.h.orig 2008-03-21 20:33:14.000000000 -0500
+++ loader.h 2008-03-21 23:44:39.000000000 -0500
@@ -134,6 +134,7 @@
char * logLevel;
char * updatessrc;
char * dogtailurl;
+ char * stg2;
pid_t fw_loader_pid;
char *fw_search_pathz;
--- loader.c.orig 2008-03-21 20:28:42.000000000 -0500
+++ loader.c 2008-03-21 23:43:12.000000000 -0500
@@ -876,6 +876,11 @@
flags |= LOADER_FLAGS_STAGE2;
setMethodFromCmdline(argv[i] + 7, loaderData);
}
+ else if (!strncasecmp(argv[i], "stg2=", 5) &&
+ (strlen(argv[i]) > 5)) {
+ loaderData->stg2 = strdup(argv[i] + 5);
+ flags |= LOADER_FLAGS_STAGE2;
+ }
else if (!strncasecmp(argv[i], "hostname=", 9))
loaderData->hostname = strdup(argv[i] + 9);
else if (!strncasecmp(argv[i], "ip=", 3))
--- method.c.orig 2008-03-22 09:20:31.000000000 -0500
+++ method.c 2008-03-21 16:43:49.000000000 -0500
@@ -96,16 +96,19 @@
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 @@
}
free(dup);
}
+
--- hdinstall.c.oldest 2008-03-22 09:31:54.000000000 -0500
+++ hdinstall.c 2008-03-21 20:04:43.000000000 -0500
@@ -61,13 +61,9 @@
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 @@
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,33 +123,26 @@
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;
}
/* given a partition device and directory, tries to mount hd install image */
-static char * setupIsoImages(char * device, char * dirName, char * location) {
+static char * setupIsoImages(char * device, char * dirName, char * location, char * stg2 ) {
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 @@
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%s", stg2 );
+ 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;
@@ -269,6 +263,7 @@
int done = 0;
char * dir = strdup("");
+ char * stg2;
char * tmpDir;
char * url = NULL;
char * buf;
@@ -279,6 +274,12 @@
char *kspartition, *ksdirectory;
/* handle kickstart data first if available */
+
+ if (loaderData->stg2 == "") {
+ stg2 = "/";
+ } else {
+ stg2 = loaderData->stg2;
+ }
if (loaderData->method == METHOD_HD && loaderData->methodData) {
kspartition = ((struct hdInstallData *)loaderData->methodData)->partition;
ksdirectory = ((struct hdInstallData *)loaderData->methodData)->directory;
@@ -299,7 +300,7 @@
if (!strncmp(kspart, "/dev/", 5))
kspart = kspart + 5;
- url = setupIsoImages(kspart, ksdirectory, location);
+ url = setupIsoImages(kspart, ksdirectory, location, stg2);
if (!url) {
logMessage(ERROR, "unable to find %s installation images on hd",
getProductName());
@@ -416,7 +417,7 @@
} else {
dir = strdup("");
}
-
+
newtFormDestroy(form);
newtPopWindow();
@@ -431,8 +432,7 @@
}
logMessage(INFO, "partition %s selected", selpart);
-
- url = setupIsoImages(selpart, dir, location);
+ url = setupIsoImages(selpart, dir, location, stg2);
if (!url) {
newtWinMessage(_("Error"), _("OK"),
_("Device %s does not appear to contain "
--- nfsinstall.c.orig 2008-03-22 08:46:05.000000000 -0500
+++ nfsinstall.c 2008-03-22 08:33:11.000000000 -0500
@@ -212,19 +212,22 @@
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);
newtPopWindow();
-
+ rc = access(buf, R_OK);
free(stage2dir);
-
- if (!rc) {
+
+ if (!rc) {
logMessage(INFO, "can access %s", buf);
- rc = mountStage2("/tmp/stage2.img", stage2dir);
-
+ rc = mountStage2(buf, stage2dir);
free(buf);
- if (rc && rc == -1) {
+ if (rc == 1) {
+ logMessage(WARNING, "unable to mount %s", buf);
+ goto trynfsiso;
+ }
+
+ if (rc == -1) {
foundinvalid = 1;
logMessage(WARNING, "not the right one");
umount("/mnt/source");
@@ -237,6 +240,7 @@
char *path;
logMessage(WARNING, "unable to access %s", buf);
+ trynfsiso:
free(buf);
umount("/mnt/source");
@@ -260,8 +264,7 @@
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 +279,8 @@
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