summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2006-11-21 15:42:46 +0000
committerChris Lumens <clumens@redhat.com>2006-11-21 15:42:46 +0000
commitf98e143509cf0b13234f5caaec778a73a0746c4d (patch)
tree3ce6e06a2d53805ff555898ab61c19cc7ee39378 /loader2
parent5927cf919a0143d09a166f715f0f5783f95cc716 (diff)
downloadanaconda-f98e143509cf0b13234f5caaec778a73a0746c4d.tar.gz
anaconda-f98e143509cf0b13234f5caaec778a73a0746c4d.tar.xz
anaconda-f98e143509cf0b13234f5caaec778a73a0746c4d.zip
If there's an error getting the kickstart file, display an error message that
allows the user to select a new location (#216446).
Diffstat (limited to 'loader2')
-rw-r--r--loader2/cdinstall.c2
-rw-r--r--loader2/hdinstall.c8
-rw-r--r--loader2/kickstart.c125
3 files changed, 94 insertions, 41 deletions
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index 0bcda9906..99dc50e23 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -441,7 +441,7 @@ int kickstartFromCD(char *kssrc) {
return 1;
}
- /* format is ks=cdrom:[/path/to/ks.cfg] */
+ /* format is cdrom:[/path/to/ks.cfg] */
kspath = "";
p = strchr(kssrc, ':');
if (p)
diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c
index 2e11a37e6..3c4590374 100644
--- a/loader2/hdinstall.c
+++ b/loader2/hdinstall.c
@@ -446,15 +446,15 @@ int kickstartFromHD(char *kssrc) {
logMessage(INFO, "getting kickstart file from harddrive");
- /* format is ks=hd:[device]:/path/to/ks.cfg */
- /* split of pieces */
+ /* format is hd:[device]:/path/to/ks.cfg */
+ /* split up pieces */
tmpstr = strdup(kssrc);
p = strchr(tmpstr, ':');
if (p)
np = strchr(p+1, ':');
/* no second colon, assume its the old format of */
- /* ks=hd:[device]/path/to/ks.cfg */
+ /* hd:[device]/path/to/ks.cfg */
/* this format is bad however because some devices have '/' in them! */
if (!np)
np = strchr(p+1, '/');
@@ -489,7 +489,7 @@ int kickstartFromBD(char *kssrc) {
logMessage(INFO, "getting kickstart file from biosdrive");
- /* format is ks=bd:[device]:/path/to/ks.cfg */
+ /* format is bd:[device]:/path/to/ks.cfg */
/* split of pieces */
tmpstr = strdup(kssrc);
p = strchr(tmpstr, ':');
diff --git a/loader2/kickstart.c b/loader2/kickstart.c
index a32ded31b..35d97c37d 100644
--- a/loader2/kickstart.c
+++ b/loader2/kickstart.c
@@ -261,7 +261,7 @@ int kickstartFromFloppy(char *kssrc) {
return 1;
}
- /* format is ks=floppy:[/path/to/ks.cfg] */
+ /* format is floppy:[/path/to/ks.cfg] */
kspath = "";
p = strchr(kssrc, ':');
if (p)
@@ -321,41 +321,94 @@ void getHostandPath(char * ksSource, char **host, char ** file, char * ip) {
}
}
-void getKickstartFile(struct loaderData_s * loaderData) {
- char * c = loaderData->ksFile;
-
- loaderData->ksFile = NULL;
-
- if (!strncmp(c, "ks=http://", 10) || !strncmp(c, "ks=ftp://", 9)) {
- if (kickstartFromUrl(c + 3, loaderData))
- return;
- loaderData->ksFile = strdup("/tmp/ks.cfg");
- } else if (!strncmp(c, "ks=nfs:", 7)) {
- if (kickstartFromNfs(c + 7, loaderData))
- return;
- loaderData->ksFile = strdup("/tmp/ks.cfg");
- } else if (!strncmp(c, "ks=floppy", 9)) {
- if (kickstartFromFloppy(c))
- return;
- loaderData->ksFile = strdup("/tmp/ks.cfg");
- } else if (!strncmp(c, "ks=hd:", 6)) {
- if (kickstartFromHD(c))
- return;
- loaderData->ksFile = strdup("/tmp/ks.cfg");
- } else if (!strncmp(c, "ks=bd:", 6)) {
- if (kickstartFromBD(c))
- return;
- loaderData->ksFile = strdup("/tmp/ks.cfg");
- } else if (!strncmp(c, "ks=cdrom", 8)) {
- if (kickstartFromCD(c))
- return;
- loaderData->ksFile = strdup("/tmp/ks.cfg");
- } else if (!strncmp(c, "ks=file:", 8)) {
- loaderData->ksFile = c + 8;
- } else if (!strcmp(c, "ks")) {
- if (kickstartFromNfs(NULL, loaderData))
- return;
- loaderData->ksFile = strdup("/tmp/ks.cfg");
+static char *newKickstartLocation(char *origLocation) {
+ const char *location;
+ char *retval = NULL;
+ newtComponent f, okay, cancel, answer, locationEntry;
+ newtGrid grid, buttons;
+
+ startNewt();
+
+ locationEntry = newtEntry(-1, -1, NULL, 60, &location, NEWT_FLAG_SCROLL);
+ newtEntrySet(locationEntry, origLocation, 1);
+
+ /* button bar at the bottom of the window */
+ buttons = newtButtonBar(_("OK"), &okay, _("Cancel"), &cancel, NULL);
+
+ grid = newtCreateGrid(1, 3);
+
+ newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT,
+ newtTextboxReflowed(-1, -1, _("Unable to download the kickstart file. Please modify the kickstart parameter below or press Cancel to proceed as an interactive installation."), 60, 0, 0, 0),
+ 0, 0, 0, 0, NEWT_ANCHOR_LEFT, 0);
+ newtGridSetField(grid, 0, 1, NEWT_GRID_COMPONENT, locationEntry,
+ 0, 1, 0, 0, NEWT_ANCHOR_LEFT, 0);
+ newtGridSetField(grid, 0, 2, NEWT_GRID_SUBGRID, buttons,
+ 0, 1, 0, 0, 0, NEWT_GRID_FLAG_GROWX);
+
+ f = newtForm(NULL, NULL, 0);
+ newtGridAddComponentsToForm(grid, f, 1);
+ newtGridWrappedWindow(grid, _("Error downloading kickstart file"));
+ newtGridFree(grid, 1);
+
+ /* run the form */
+ answer = newtRunForm(f);
+
+ if (answer != cancel)
+ retval = strdup(location);
+
+ newtFormDestroy(f);
+ newtPopWindow();
+
+ return retval;
+}
+
+void getKickstartFile(struct loaderData_s *loaderData) {
+ char *c;
+ int rc = 1;
+
+ /* Chop off the parameter name, if given. */
+ if (!strncmp(loaderData->ksFile, "ks=", 3))
+ c = loaderData->ksFile+3;
+ else
+ c = loaderData->ksFile;
+
+ while (rc != 0) {
+ if (!strncmp(c, "ks", 2)) {
+ rc = kickstartFromNfs(NULL, loaderData);
+ loaderData->ksFile = strdup("/tmp/ks.cfg");
+ } else if (!strncmp(c, "http://", 7) || !strncmp(c, "ftp://", 6)) {
+ rc = kickstartFromUrl(c, loaderData);
+ loaderData->ksFile = strdup("/tmp/ks.cfg");
+ } else if (!strncmp(c, "nfs:", 4)) {
+ rc = kickstartFromNfs(c+4, loaderData);
+ loaderData->ksFile = strdup("/tmp/ks.cfg");
+ } else if (!strncmp(c, "floppy", 6)) {
+ rc = kickstartFromFloppy(c);
+ loaderData->ksFile = strdup("/tmp/ks.cfg");
+ } else if (!strncmp(c, "hd:", 3)) {
+ rc = kickstartFromHD(c);
+ loaderData->ksFile = strdup("/tmp/ks.cfg");
+ } else if (!strncmp(c, "bd:", 3)) {
+ rc = kickstartFromBD(c);
+ loaderData->ksFile = strdup("/tmp/ks.cfg");
+ } else if (!strncmp(c, "cdrom", 5)) {
+ rc = kickstartFromCD(c);
+ loaderData->ksFile = strdup("/tmp/ks.cfg");
+ } else if (!strncmp(c, "file:", 5)) {
+ loaderData->ksFile = c+5;
+ }
+
+ if (rc != 0) {
+ if (loaderData->ksFile != NULL)
+ free(loaderData->ksFile);
+
+ loaderData->ksFile = newKickstartLocation(c);
+
+ if (loaderData->ksFile != NULL)
+ return getKickstartFile(loaderData);
+ else
+ return;
+ }
}
flags |= LOADER_FLAGS_KICKSTART;