diff options
-rw-r--r-- | loader2/hdinstall.c | 6 | ||||
-rw-r--r-- | loader2/loader.c | 29 | ||||
-rw-r--r-- | loader2/loader.h | 2 | ||||
-rw-r--r-- | loader2/nfsinstall.c | 13 | ||||
-rw-r--r-- | loader2/urlinstall.c | 7 |
5 files changed, 57 insertions, 0 deletions
diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c index eaf3da98f..4a577eb59 100644 --- a/loader2/hdinstall.c +++ b/loader2/hdinstall.c @@ -180,6 +180,9 @@ char * mountHardDrive(struct installMethod * method, if (!kspartition || !ksdirectory) { logMessage(ERROR, "missing partition or directory specification"); loaderData->method = -1; + + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; } else { /* if we start with /dev, strip it (#121486) */ char *kspart = kspartition; @@ -191,6 +194,9 @@ char * mountHardDrive(struct installMethod * method, logMessage(ERROR, "unable to find %s installation images on hd", getProductName()); loaderData->method = -1; + + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; } else { free(kspartition); free(ksdirectory); diff --git a/loader2/loader.c b/loader2/loader.c index 7ed1042cc..378e5299d 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -1185,6 +1185,15 @@ static char *doLoaderMain(struct loaderData_s *loaderData, logMessage(INFO, "no stage2= given, assuming %s", tmp); setStage2LocFromCmdline(tmp, loaderData); free(tmp); + + /* If we had to infer a stage2= location, but the repo= parameter + * we based this guess on was wrong, we need to correct the typo + * in both places. Unfortunately we can't really know what the + * user meant, so the best we can do is take the results of + * running stage2= through the UI and chop off any /images/whatever + * path that's at the end of it. + */ + loaderData->inferredStage2 = 1; } } @@ -1525,7 +1534,27 @@ static char *doLoaderMain(struct loaderData_s *loaderData, logMessage(INFO, "got stage2 at url %s", url); step = STEP_DONE; dir = 1; + + if (loaderData->invalidRepoParam) { + char *newInstRepo; + + /* Doesn't contain /images? Let's not even try. */ + if (strstr(url, "/images") == NULL) + break; + + if (asprintf(&newInstRepo, "%.*s", + (int) (strstr(url, "/images")-url), url) == -1) { + logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__); + abort(); + } + + free(loaderData->instRepo); + loaderData->instRepo = newInstRepo; + logMessage(INFO, "reset repo= parameter to %s", + loaderData->instRepo); + } } + break; } diff --git a/loader2/loader.h b/loader2/loader.h index e18a1cbda..ac28f1363 100644 --- a/loader2/loader.h +++ b/loader2/loader.h @@ -138,6 +138,8 @@ struct loaderData_s { size_t fw_search_pathz_len; moduleInfoSet modInfo; + + int inferredStage2, invalidRepoParam; }; /* 64 bit platforms, definitions courtesy of glib */ diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c index efde32a1c..836ef9704 100644 --- a/loader2/nfsinstall.c +++ b/loader2/nfsinstall.c @@ -138,6 +138,10 @@ char * mountNfsImage(struct installMethod * method, if (!host || !directory) { logMessage(ERROR, "missing host or directory specification"); + + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; + loaderData->method = -1; break; } else { @@ -182,6 +186,9 @@ char * mountNfsImage(struct installMethod * method, if (loaderData->method >= 0) loaderData->method = -1; + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; + break; } @@ -241,6 +248,9 @@ char * mountNfsImage(struct installMethod * method, if (loaderData->method >= 0) loaderData->method = -1; + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; + break; } @@ -257,6 +267,9 @@ char * mountNfsImage(struct installMethod * method, if (loaderData->method >= 0) loaderData->method = -1; + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; + break; } diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c index 48d1cb73d..0f0e70c31 100644 --- a/loader2/urlinstall.c +++ b/loader2/urlinstall.c @@ -204,6 +204,10 @@ char *mountUrlImage(struct installMethod *method, char *location, loaderData->method = -1; free(loaderData->stage2Data); loaderData->stage2Data = NULL; + + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; + break; } @@ -248,6 +252,9 @@ char *mountUrlImage(struct installMethod *method, char *location, if (loaderData->method >= 0) loaderData->method = -1; + + if (loaderData->inferredStage2) + loaderData->invalidRepoParam = 1; } else { stage = URL_STAGE_DONE; } |