summaryrefslogtreecommitdiffstats
path: root/loader2/kickstart.c
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/kickstart.c
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/kickstart.c')
-rw-r--r--loader2/kickstart.c125
1 files changed, 89 insertions, 36 deletions
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;