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

[PATCH rhel6-branch 11/11] Always activate first kickstart network device (#668395)



No matter whether it has new --activate flag set.
To follow rhel 5 behaviour.
---
 loader/kickstart.c |   16 ++++++++++++++++
 loader/kickstart.h |    1 +
 loader/loader.c    |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index 37125ce..b418d74 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -543,6 +543,22 @@ static void setMediaCheck(struct loaderData_s * loaderData, int argc,
     return;
 }
 
+void addActivateToFirstKsNetworkCommand() {
+    int i = 0;
+
+    for (i = 0; i < numCommands; i++) {
+        if (commands[i].code == KS_CMD_NETWORK) {
+            logMessage(INFO, "adding --activate to first kickstart network command");
+            commands[i].argc++;
+            commands[i].argv = g_realloc(commands[i].argv,
+                    sizeof(gchar *) * (commands[i].argc + 1));
+            commands[i].argv[commands[i].argc -1] = "--activate";
+            commands[i].argv[commands[i].argc] = NULL;
+            break;
+        }
+    }
+}
+
 void runKickstart(struct loaderData_s * loaderData) {
     struct ksCommandNames * cmd;
     int argc;
diff --git a/loader/kickstart.h b/loader/kickstart.h
index 574026b..2a3b334 100644
--- a/loader/kickstart.h
+++ b/loader/kickstart.h
@@ -50,5 +50,6 @@ int isKickstartFileRemote(char *ksFile);
 void getKickstartFile(struct loaderData_s * loaderData);
 void runKickstart(struct loaderData_s * loaderData);
 int getKickstartFromBlockDevice(char *device, char *path);
+void addActivateToFirstKsNetworkCommand();
 
 #endif
diff --git a/loader/loader.c b/loader/loader.c
index 7d7863b..2b1e6cd 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2194,6 +2194,7 @@ int main(int argc, char ** argv) {
             getKickstartFile(&loaderData);
         if (FL_KICKSTART(flags) && 
             (ksReadCommands((ksFile)?ksFile:loaderData.ksFile)!=LOADER_ERROR)) {
+            addActivateToFirstKsNetworkCommand();
             runKickstart(&loaderData);
         }
     }
-- 
1.7.2


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