[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 19/29] Initialize loaderData->method.



First set it to METHOD_URL since that's what the UI defaults to.  Then if
we're given a repo= parameter, set it there.  Otherwise, we will end up in
situations where NFS installs attempt to fetch updates.img and product.img
via HTTP.
---
 loader/loader.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index 894e6c7..221be0c 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1078,6 +1078,19 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData,
             } else if (!strcasecmp(k, "stage2")) {
                 logMessage(WARNING, "stage2= is deprecated.  Please use repo= instead.");
                 flags |= LOADER_FLAGS_ASKMETHOD;
+            } else if (!strcasecmp(k, "repo")) {
+                loaderData->instRepo = g_strdup(v);
+
+                /* We still have to set the method in case repo= was used so we
+                 * know how to get updates.img and product.img, and it only
+                 * gets set elsewhere on interactive installs.
+                 */
+                if (!strncmp(v, "nfs:", 4))
+                    loaderData->method = METHOD_NFS;
+                else if (!strncmp(v, "hd:", 3))
+                    loaderData->method = METHOD_HD;
+                else if (!strncmp(v, "cd:", 3))
+                    loaderData->method = METHOD_CDROM;
             } else if (!strcasecmp(k, "hostname")) {
                 loaderData->hostname = g_strdup(v);
             } else if (!strcasecmp(k, "ip")) {
@@ -1881,7 +1894,7 @@ int main(int argc, char ** argv) {
     }
 
     memset(&loaderData, 0, sizeof(loaderData));
-    loaderData.method = -1;
+    loaderData.method = METHOD_URL;
     loaderData.fw_loader_pid = -1;
     loaderData.fw_search_pathz_len = -1;
     loaderData.dhcpTimeout = -1;
-- 
1.7.1.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]