[PATCH master 12/13] Do not activate first ks network device automatically in non-network installs.

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

 



For non-network installs it restores rhel 5 behaviour that
was changed in master by commit 9767cb5fce174e8fcf28d06ad6f48384129a7cd4
(which would activate the device in any case).

Now new --activate option can be used if bringing up the device
in non-network install is desired.

Port from rhel6-branch.
Related: rhbz#638131
---
 loader/kickstart.c |   26 +++++++++++++-------------
 loader/loader.c    |    4 +++-
 loader/net.c       |   15 +++++++++++++++
 loader/net.h       |    1 +
 4 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/loader/kickstart.c b/loader/kickstart.c
index a09970c..04605e6 100644
--- a/loader/kickstart.c
+++ b/loader/kickstart.c
@@ -47,6 +47,7 @@
 #include "driverdisk.h"
 #include "net.h"
 #include "method.h"
+#include "ibft.h"
 
 #include "nfsinstall.h"
 #include "urlinstall.h"
@@ -89,14 +90,14 @@ commandFunc_t ksTable[] = {
     &setKickstartHD,
     &setKickstartKeyboard,
     &setKickstartLanguage,
-    &setKickstartNetwork,
     &setKickstartNfs,
     &setKickstartUrl,
+    &setVnc,
+    &setKickstartNetwork,
     &setMediaCheck,
     &setSELinux,
     &setShutdown,
     &setUpdates,
-    &setVnc,
     &useKickstartDD,
     NULL
 };
@@ -412,13 +413,7 @@ int isKickstartFileRemote(char *ksFile) {
         location = ksFile + 3;
     }
 
-    if (!strncmp(location, "http", 4) ||
-        !strncmp(location, "ftp://";, 6) ||
-        !strncmp(location, "nfs:", 4)) {
-        return 1;
-    } else {
-        return 0;
-    }
+    return isURLRemote(location);
 }
 
 void getKickstartFile(struct loaderData_s *loaderData) {
@@ -847,15 +842,20 @@ static void setKickstartNetwork(struct loaderData_s * loaderData, PyObject *hand
 
         Py_XDECREF(noksdev);
 
-        if (!is_nm_connected()) {
-            logMessage(INFO, "activating because no network connection is available");
+        /* Always activate first network command device for network
+         * installs(RHEL 5 behaviour) */
+        if (!i &&
+            (isURLRemote(loaderData->instRepo) ||
+             FL_EARLY_NETWORKING(flags) ||
+             ibft_present())) {
+            logMessage(INFO, "activating first device from kickstart because network is needed");
             activateDevice(loaderData, &iface);
             continue;
         }
 
+
         attr = getObject(ele, "activate", 0);
-        /* Always activate first network command device (RHEL 5 behaviour) */
-        if (isTrue(attr) || !i) {
+        if (isTrue(attr)) {
             logMessage(INFO, "activating because --activate flag is set");
             activateDevice(loaderData, &iface);
         } else {
diff --git a/loader/loader.c b/loader/loader.c
index d16a309..e7dc392 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1460,7 +1460,7 @@ static void doLoaderMain(struct loaderData_s *loaderData,
 
             case STEP_NETWORK: {
                 if (((installMethods[validMethods[loaderData->method]].type !=
-                       DEVICE_NETWORK) && (!hasGraphicalOverride()) &&
+                       DEVICE_NETWORK) &&
                       !FL_ASKNETWORK(flags) &&
                       !FL_EARLY_NETWORKING(flags) && 
                       !ibft_present()) ||
@@ -1971,6 +1971,8 @@ int main(int argc, char ** argv) {
         logMessage(INFO, "text mode forced due to serial/virtpconsole");
         flags |= LOADER_FLAGS_TEXT;
     }
+    if (hasGraphicalOverride())
+        flags |= LOADER_FLAGS_EARLY_NETWORKING;
     set_fw_search_path(&loaderData, "/firmware:/lib/firmware");
     start_fw_loader(&loaderData);
 
diff --git a/loader/net.c b/loader/net.c
index 6ea3c7a..229910c 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -2187,4 +2187,19 @@ int wait_for_iface_disconnection(char *ifname) {
     g_object_unref(client);
     return 3;
 }
+
+int isURLRemote(char *url) {
+    if (url == NULL) {
+        return 0;
+    }
+
+    if (!strncmp(url, "http", 4) ||
+        !strncmp(url, "ftp://";, 6) ||
+        !strncmp(url, "nfs:", 4)) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4: */
diff --git a/loader/net.h b/loader/net.h
index 101beaa..c17b9bb 100644
--- a/loader/net.h
+++ b/loader/net.h
@@ -80,5 +80,6 @@ int disconnectDevice(char *device);
 void splitHostname (char *str, char **host, char **port);
 int wait_for_iface_activation(char * ifname);
 int wait_for_iface_disconnection(char *ifname);
+int isURLRemote(char *url);
 
 #endif
-- 
1.7.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux