OK, should I be thinking that stage2= will be the replacement for
method= for stage1? I'm getting that feeling, just want to be sure.
Yes, though not really a complete replacement. The final goal is that
stage2= points to just the stage2.img file, while method= points to just
the package repository. Perhaps at that point we rename it to repo= to
avoid confusion? Don't know quite what to do here yet.
/wish list
Maybe stage2.img and related boot.iso could just be moved to the updates
repo all together. The boot.iso could then be updated, containing the
latest changes that lead to the need for a updates.img in the first
place, as required. Now you really have disconnected the location of
stage2 from the primary repo.
wish list/
Back to what is required now in loader, The boot.iso is mounted for
stage2, if present, else look for an iso-image to use for stage2 for
nfsiso, hd(iso), or tree-path for nfs. That just leaves net installs,
where what you're really being asked is for the location of stage2 and
not the location of a repo in stage1. Anaconda should then discard the
net install's method-path, but not method, that is passed from loader
when building its own repo list with data supplied from a kickstart file
and/or the repo editor.
Does that sum up what maybe required here? Think all the *install.c
files could become just one install.c file here. Is that what I should
work towards?
I was thinking of something like setmethodfromcmdline but for stage2.
attached is a rough patch as proof of concept. Mounts stage2 at the
given path, then returns the url for the method string.
03:37:07 INFO : mounted loopback device /mnt/runtime on /dev/loop0 as
/mnt/isodir//images/stage2.img
03:37:07 INFO : URL_STAGE_MAIN - url is
http://download.fedora.redhat.com/pub/fedora/linux/development/i386/os
+ /* handle stage2 data first if available */
+ if (loaderData->stage2 == METHOD_HD && loaderData->stage2Data) {
+ kspartition = ((struct hdstage2Data *)loaderData->stage2Data)->partition;
+ ksdirectory = ((struct hdstage2Data *)loaderData->stage2Data)->directory;
+ logMessage(INFO, "HD Stage2 partition is %s, dir is %s", kspartition, ksdirectory);
+ }
+
/* handle kickstart data first if available */
if (loaderData->method == METHOD_HD && loaderData->methodData) {
kspartition = ((struct hdInstallData *)loaderData->methodData)->partition;
+ /* handle stage2 data first if available */
+ if (loaderData->stage2 == METHOD_HD && loaderData->stage2Data) {
+ char * stg2part;
+ char * stg2dir;
+ stg2url = ((struct hdstage2Data *)loaderData->stage2Data)->stg2loc;
+ stg2part = ((struct hdstage2Data *)loaderData->stage2Data)->partition;
+ stg2dir = ((struct hdstage2Data *)loaderData->stage2Data)->directory;
+ logMessage(INFO, "LOADER Stage2 partition is %s, dir is %s", stg2part, stg2dir);
+ if (stg2url)
+ logMessage(INFO, "LOADER URL_STAGE2 - stg2url is %s", stg2url);
+/* return stg2url;
+*/
/* check to see if we have a CD. If we have one, then
* we can fast-path the CD and not make people answer questions in
* text mode. */
if (!FL_ASKMETHOD(flags) && !FL_KICKSTART(flags)) {
- url = findAnacondaCD(location, !FL_RESCUE(flags));
+ stg2url = findAnacondaCD(location, !FL_RESCUE(flags));
/* if we found a CD and we're not in rescue or vnc mode return */
/* so we can short circuit straight to stage 2 from CD */
- if (url && (!FL_RESCUE(flags) && !hasGraphicalOverride()))
- return url;
+ if (stg2url && (!FL_RESCUE(flags) && !hasGraphicalOverride()))
+ return stg2url;
else {
rhcdfnd = 1;
methodNum = 0;
}
}
+ }
+
if (!FL_CMDLINE(flags))
startNewt();
@@ -1124,9 +1139,9 @@
*
* Alternately, if we're in a VNC install based from CD we
* can skip this step because we already found the CD */
- if (url) {
+ if (stg2url) {
if (FL_RESCUE(flags)) {
- return url;
+ return stg2url;
} else if (rhcdfnd) {
step = STEP_NETWORK;
dir = 1;
@@ -1374,8 +1389,8 @@
/* we get this case when we're doing a VNC install from CD */
/* and we didnt short circuit earlier because we had to */
/* prompt for network info for vnc to work */
- if (url && rhcdfnd)
- return url;
+ if (stg2url && rhcdfnd)
+ return stg2url;
/* We assume that if stage2= was given, it's pointing at a stage2 image
* file. Trim the filename off the end, and that's the directory where
- * updates.img and friends must live.
+ * updates.img and friends must live.JV BUT hacks off /os in url path
*/
if (FL_STAGE2(flags)) {
/* Has to have a / in it somewhere, since it has to be a path name. */
if (!strrchr(ui->prefix, '/'))
return 1;
+
else
path = strndup(ui->prefix, strrchr(ui->prefix, '/') - ui->prefix);
- if (!path)
+ if (path)
+ logMessage(INFO, "stage2 path is %s", path);
+ else
return 1;
}
else
@@ -161,27 +164,30 @@
} else {
stage2img = "stage2.img";
}
-
rc = asprintf(&buf, "%s/%s", path, stage2img);
rc = asprintf(&tmp, "/tmp/%s", stage2img);
rc = loadSingleUrlImage(ui, buf, tmp,
"/mnt/runtime", "/dev/loop0", 0);
free(buf);
- }
- else {
+ } else {
/* We already covered the case of ui->prefix not having a / in it
* at the beginning, so don't worry about it here.
*/
- rc = asprintf(&tmp, "/tmp/%s", strrchr(ui->prefix, '/'));
- rc = loadSingleUrlImage(ui, ui->prefix, tmp, "/mnt/runtime",
- "/dev/loop0", 0);
- }
+/* rc = asprintf(&tmp, "/tmp/%s", strrchr(ui->prefix, '/'));
+ * rc = loadSingleUrlImage(ui, ui->prefix, tmp, "/mnt/runtime",
+ * "/dev/loop0", 0);
+*/
+ stage2img = "stage2.img";
+ rc = asprintf(&buf, "%s/%s", path, stage2img);
+ rc = mountStage2(buf, path);
+ free(buf);
+ }
free(tmp);
free(path);
if (rc) {
- if (rc != 2)
+ if (rc != 0)
newtWinMessage(_("Error"), _("OK"),
_("Unable to retrieve the install image."));
return 1;
@@ -209,6 +215,7 @@
struct iurlinfo ui;
char needsSecondary = ' ';
char * cdurl = NULL;
+ char * stg2url = NULL;
enum { URL_STAGE_MAIN, URL_STAGE_SECOND, URL_STAGE_FETCH,
URL_STAGE_DONE } stage = URL_STAGE_MAIN;
@@ -218,6 +225,24 @@
while (stage != URL_STAGE_DONE) {
switch(stage) {
case URL_STAGE_MAIN:
+
+ /* handle stage2 data first if available */
+ if (loaderData->stage2 == METHOD_HD && loaderData->stage2Data) {
+ char * stg2part;
+ char * stg2dir;
+ stg2part = ((struct hdstage2Data*)loaderData->stage2Data)->partition;
+ stg2dir = ((struct hdstage2Data *)loaderData->stage2Data)->directory;
+ logMessage(INFO, "URL Stage2 partition is %s, dir is %s", stg2part, stg2dir);
+
+ /*if exist, duplicate */
+ if (stg2part)
+ stg2part = strdup(stg2part);
+ if (stg2dir)
+ stg2dir = strdup(stg2dir);
+ logMessage(INFO, "URL setupIso for Stage2");
+ setupIsoImages(stg2part, stg2dir, location);
+ }
+
if (loaderData->method == METHOD_URL && loaderData->methodData) {
url = ((struct urlInstallData *)loaderData->methodData)->url;
logMessage(INFO, "URL_STAGE_MAIN - url is %s", url);
@@ -266,10 +292,10 @@
* one over the network. However, passing stage2= overrides
* this check.
*/
- if (!FL_STAGE2(flags))
+ if (!FL_STAGE2(flags)){
cdurl = findAnacondaCD(location, 0);
- if (cdurl) {
+ if (cdurl) {
logMessage(INFO, "Detected stage 2 image on CD");
winStatus(50, 3, _("Media Detected"),
_("Local installation media detected..."), 0);
@@ -277,21 +303,22 @@
newtPopWindow();