summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2008-06-03 17:31:45 -0400
committerChris Lumens <clumens@redhat.com>2008-06-18 10:44:56 -0400
commit2f7fd20db45ca8e48592866ebcd96469576a4b0c (patch)
tree381a955a14d0bcc358d711e884b072033411457d /loader2
parentc6c820483fb3ff01c235926402581b1163bea1c5 (diff)
downloadanaconda-2f7fd20db45ca8e48592866ebcd96469576a4b0c.tar.gz
anaconda-2f7fd20db45ca8e48592866ebcd96469576a4b0c.tar.xz
anaconda-2f7fd20db45ca8e48592866ebcd96469576a4b0c.zip
Strip cdinstall.c down to just looking for the stage2 image.
This includes changing the API of setupCdrom to no longer take a requirepkgs parameter. Doing that also causes a cascade of having to change findAnacondaCD and all its callers for the same reason.
Diffstat (limited to 'loader2')
-rw-r--r--loader2/cdinstall.c80
-rw-r--r--loader2/cdinstall.h3
-rw-r--r--loader2/hdinstall.c2
-rw-r--r--loader2/loader.c37
-rw-r--r--loader2/nfsinstall.c2
-rw-r--r--loader2/urlinstall.c2
6 files changed, 49 insertions, 77 deletions
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index c6bc1db0f..a899a29b8 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -67,6 +67,9 @@ void ejectCdrom(char *device) {
}
}
+/* Commented out for now due to -Wall -Werror */
+#if 0
+
/*
* Given cd device cddriver, this function will attempt to check its internal
* checksum.
@@ -214,27 +217,20 @@ static void queryCDMediaCheck(char *dev, char *location) {
}
}
}
+#endif
-/* set up a cdrom, nominally for installation
- *
- * location: where to mount the cdrom at
- * interactive: whether or not to prompt about questions/errors (1 is yes)
- *
- * loaderData is the kickstart info, can be NULL meaning no info
- *
- * requirepkgs=1 means CD should have packages, otherwise we just find stage2
+/* Set up a CD/DVD drive to mount the stage2 image from. If successful, the
+ * stage2 image will be left mounted on /mnt/runtime.
*
- * side effect: found cdrom is mounted on 'location' (usually /mnt/source, but
- * could also be /mnt/stage2 if we're just looking for a stage2 image). stage2
- * mounted on /mnt/runtime.
+ * location: Where to mount the media at (usually /mnt/stage2)
+ * interactive: Whether or not to prompt about questions/errors
+ * loaderData: The usual, can be NULL if no info
*/
-char * setupCdrom(char * location, struct loaderData_s * loaderData,
- int interactive, int requirepkgs) {
+char *setupCdrom(char *location, struct loaderData_s *loaderData,
+ int interactive) {
int i, r, rc;
- int foundinvalid = 0;
int stage2inram = 0;
- char *buf, *stage2loc, *discinfoloc;
- char *stage2img;
+ char *buf, *stage2loc, *stage2img;
struct device ** devices;
char *cddev = NULL;
@@ -244,13 +240,7 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
return NULL;
}
- if (loaderData && FL_STAGE2(flags)) {
- stage2loc = strdup(location);
- r = asprintf(&discinfoloc, "%s/.discinfo", imageDir);
- } else {
- r = asprintf(&stage2loc, "%s/images/stage2.img", location);
- r = asprintf(&discinfoloc, "%s/.discinfo", location);
- }
+ r = asprintf(&stage2loc, "%s/images/stage2.img", location);
/* JKFIXME: ASSERT -- we have a cdrom device when we get here */
do {
@@ -270,36 +260,30 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
if (!(rc=doPwMount(devices[i]->device, location, "iso9660", "ro"))) {
cddev = devices[i]->device;
- if (!access(stage2loc, R_OK) &&
- (!requirepkgs || !access(discinfoloc, R_OK))) {
-
+ if (!access(stage2loc, R_OK)) {
/* 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) {
rc = copyFile(stage2loc, "/tmp/stage2.img");
- stage2img = "/tmp/stage2.img";
+ stage2img = strdup("/tmp/stage2.img");
stage2inram = 1;
} else {
stage2img = strdup(stage2loc);
stage2inram = 0;
}
+
rc = mountStage2(stage2img);
+ free(stage2loc);
+ free(stage2img);
if (rc) {
logMessage(INFO, "mounting stage2 failed");
-
umount(location);
- if (rc == -1)
- foundinvalid = 1;
continue;
}
- /* do the media check */
- if (requirepkgs)
- queryCDMediaCheck(devices[i]->device, location);
-
/* if in rescue mode and we copied stage2 to RAM */
/* we can now unmount the CD */
if (FL_RESCUE(flags) && stage2inram) {
@@ -309,14 +293,10 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
r = asprintf(&buf, "cdrom://%s:%s",
devices[i]->device, location);
- free(stage2loc);
- free(discinfoloc);
-
if (r == -1)
return NULL;
else
return buf;
-
}
/* this wasnt the CD we were looking for, clean up and */
@@ -328,16 +308,11 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
if (interactive) {
char * buf;
int i;
- if (foundinvalid)
- i = asprintf(&buf, _("No %s disc was found which matches your "
- "boot media. Please insert the %s disc "
- "and press %s to retry."),
- getProductName(), getProductName(), _("OK"));
- else
- i = asprintf(&buf, _("The %s disc was not found in any of your "
- "CDROM drives. Please insert the %s disc "
- "and press %s to retry."),
- getProductName(), getProductName(), _("OK"));
+
+ i = asprintf(&buf, _("The %s disc was not found in any of your "
+ "CDROM drives. Please insert the %s disc "
+ "and press %s to retry."),
+ getProductName(), getProductName(), _("OK"));
ejectCdrom(cddev);
rc = newtWinChoice(_("Disc Not Found"),
@@ -353,21 +328,18 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
err:
free(stage2loc);
- free(discinfoloc);
return NULL;
}
/* try to find a install CD non-interactively */
-char * findAnacondaCD(char * location,
- int requirepkgs) {
- return setupCdrom(location, NULL, 0, requirepkgs);
+char * findAnacondaCD(char *location) {
+ return setupCdrom(location, NULL, 0);
}
/* look for a CD and mount it. if we have problems, ask */
char * mountCdromImage(struct installMethod * method,
char * location, struct loaderData_s * loaderData) {
-
- return setupCdrom(location, loaderData, 1, !FL_RESCUE(flags));
+ return setupCdrom(location, loaderData, 1);
}
void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv) {
diff --git a/loader2/cdinstall.h b/loader2/cdinstall.h
index 5248d5114..a0ecbc31a 100644
--- a/loader2/cdinstall.h
+++ b/loader2/cdinstall.h
@@ -25,8 +25,7 @@
char * mountCdromImage(struct installMethod * method,
char * location, struct loaderData_s * loaderData);
-char * findAnacondaCD(char * location, int requirepkgs);
-
+char * findAnacondaCD(char * location);
void setKickstartCD(struct loaderData_s * loaderData, int argc,
char ** argv);
diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c
index 3b9937749..87b0713c4 100644
--- a/loader2/hdinstall.c
+++ b/loader2/hdinstall.c
@@ -73,7 +73,7 @@ static int loadHDImages(char * prefix, char * dir,
* passing stage2= overrides this check.
*/
if (!FL_STAGE2(flags))
- cdurl = findAnacondaCD("/mnt/stage2", 0);
+ cdurl = findAnacondaCD("/mnt/stage2");
if (cdurl) {
logMessage(INFO, "Detected stage 2 image on CD");
diff --git a/loader2/loader.c b/loader2/loader.c
index c3460be90..b0ded8e2f 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -1008,23 +1008,6 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
}
}
- /* Here's how it works: stage2= points to just the location of the
- * stage2.img file. repo= points to the installation source. This is
- * the same as the old method=, but makes the meaning more explicit.
- * If stage2= is not given, we will try to piece together a valid
- * setting based on the contents of repo=. If repo= is not given, we
- * will try to figure it out once we're in stage2.
- */
- if (loaderData->instRepo && !loaderData->stage2Data) {
- char *tmp;
- int rc;
-
- rc = asprintf(&tmp, "%s/images/stage2.img", loaderData->instRepo);
- logMessage(INFO, "no stage2= given, assuming %s", tmp);
- setStage2LocFromCmdline(tmp, loaderData);
- free(tmp);
- }
-
readNetInfo(&loaderData);
/* NULL terminates the array of extra args */
@@ -1119,6 +1102,24 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
if (url) {
setStage2LocFromCmdline(url, loaderData);
haveStage2 = 1;
+
+ logMessage(INFO, "Detected stage 2 image on CD");
+ winStatus(50, 3, _("Media Detected"),
+ _("Local installation media detected..."), 0);
+ sleep(3);
+ newtPopWindow();
+ } else if (loaderData->instRepo) {
+ /* If no CD/DVD with a stage2 image was found and we were given a
+ * repo=/method= parameter, try to piece together a valid setting
+ * for the stage2= parameter based on that.
+ */
+ char *tmp;
+ int rc;
+
+ rc = asprintf(&tmp, "%s/images/stage2.img", loaderData->instRepo);
+ logMessage(INFO, "no stage2= given, assuming %s", tmp);
+ setStage2LocFromCmdline(tmp, loaderData);
+ free(tmp);
}
}
@@ -1418,7 +1419,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData,
case STEP_STAGE2: {
if (url) {
- logMessage(INFO, "got stage2 at url %s", url);
+ logMessage(INFO, "stage2 url is %s", url);
return url;
}
diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c
index 0be2aaaec..9024e3a2c 100644
--- a/loader2/nfsinstall.c
+++ b/loader2/nfsinstall.c
@@ -164,7 +164,7 @@ char * mountNfsImage(struct installMethod * method,
/* Try to see if we're booted off of a CD with stage2. However,
* passing stage2= overrides this check.
*/
- if (!FL_STAGE2(flags) && (stage2OnCD || findAnacondaCD("/mnt/stage2", 0))) {
+ if (!FL_STAGE2(flags) && (stage2OnCD || findAnacondaCD("/mnt/stage2"))) {
stage2OnCD = 1;
logMessage(INFO, "Detected stage 2 image on CD");
winStatus(50, 3, _("Media Detected"),
diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c
index 9bb230ba9..7e34d48b8 100644
--- a/loader2/urlinstall.c
+++ b/loader2/urlinstall.c
@@ -270,7 +270,7 @@ char * mountUrlImage(struct installMethod * method,
* this check.
*/
if (!FL_STAGE2(flags))
- cdurl = findAnacondaCD(location, 0);
+ cdurl = findAnacondaCD(location);
if (cdurl) {
logMessage(INFO, "Detected stage 2 image on CD");