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

[rhel5-branch] Adds interactive install support for NFS options (#493052)



How tested:
* starting installation without a kickstart, specifying server and image path manually, without options and with "nfsver=3,tcp"
* starting with an intentionally broken NFS kickstart file to see whether the NFS mount window appears with the kickstart options prefilled
* starting with a good NFS kickstart file to check that the installation starts correctly
---
 loader2/net.c        |    3 ++-
 loader2/net.h        |    2 +-
 loader2/nfsinstall.c |   23 +++++++++++++++++------
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/loader2/net.c b/loader2/net.c
index 17e6e34..58af1db 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -70,7 +70,8 @@ char *netServerPrompt = \
        "\n"
        "    o the name or IP number of your %s server\n" 
        "    o the directory on that server containing\n" 
-       "      %s for your architecture\n");
+       "      %s for your architecture\n"
+       "    o optionally, parameters for the NFS mount\n");
 
 /**
  * Callback function for the CIDR entry boxes on the manual TCP/IP
diff --git a/loader2/net.h b/loader2/net.h
index 1d3c3d8..48e8306 100644
--- a/loader2/net.h
+++ b/loader2/net.h
@@ -70,7 +70,7 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev);
 int findHostAndDomain(struct networkDeviceConfig * dev);
 int writeResolvConf(struct networkDeviceConfig * net);
 extern char *netServerPrompt;
-int nfsGetSetup(char ** hostptr, char ** dirptr);
+int nfsGetSetup(char ** hostptr, char ** dirptr, char ** optsptr);
 void initLoopback(void);
 int chooseNetworkInterface(struct loaderData_s * loaderData);
 void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, 
diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c
index d70fefb..4327b29 100644
--- a/loader2/nfsinstall.c
+++ b/loader2/nfsinstall.c
@@ -37,11 +37,12 @@
 /* boot flags */
 extern uint64_t flags;
 
-int nfsGetSetup(char ** hostptr, char ** dirptr) {
-    struct newtWinEntry entries[3];
+int nfsGetSetup(char ** hostptr, char ** dirptr, char ** optsptr) {
+    struct newtWinEntry entries[4];
     char * buf;
     char * newServer = *hostptr ? strdup(*hostptr) : NULL;
     char * newDir = *dirptr ? strdup(*dirptr) : NULL;
+    char * newMountOpts = *optsptr ? strdup(*optsptr) : NULL;
     int rc;
 
     entries[0].text = _("NFS server name:");
@@ -50,8 +51,11 @@ int nfsGetSetup(char ** hostptr, char ** dirptr) {
     entries[1].text = sdupprintf(_("%s directory:"), getProductName());
     entries[1].value = (const char **) &newDir;
     entries[1].flags = NEWT_FLAG_SCROLL;
-    entries[2].text = NULL;
-    entries[2].value = NULL;
+    entries[2].text = _("NFS mount options (optional):");
+    entries[2].value = (const char **) &newMountOpts;
+    entries[2].flags = NEWT_FLAG_SCROLL;
+    entries[3].text = NULL;
+    entries[3].value = NULL;
     buf = sdupprintf(_(netServerPrompt), _("NFS"), getProductName());
     rc = newtWinEntries(_("NFS Setup"), buf, 60, 5, 15,
                         24, entries, _("OK"), _("Back"), NULL);
@@ -60,13 +64,16 @@ int nfsGetSetup(char ** hostptr, char ** dirptr) {
     if (rc == 2) {
         if (newServer) free(newServer);
         if (newDir) free(newDir);
+        if (newMountOpts) free(newMountOpts);
         return LOADER_BACK;
     }
 
     if (*hostptr) free(*hostptr);
     if (*dirptr) free(*dirptr);
+    if (*optsptr) free(*optsptr);
     *hostptr = newServer;
     *dirptr = newDir;
+    *optsptr = newMountOpts;
 
     return 0;
 }
@@ -107,8 +114,11 @@ char * mountNfsImage(struct installMethod * method,
                 } else {
                     host = strdup(host);
                     directory = strdup(directory);
+                    if (mountOpts) {
+                        mountOpts = strdup(mountOpts);
+                    }
                 }
-            } else if (nfsGetSetup(&host, &directory) == LOADER_BACK) {
+            } else if (nfsGetSetup(&host, &directory, &mountOpts) == LOADER_BACK) {
                 return NULL;
             }
              
@@ -133,7 +143,7 @@ char * mountNfsImage(struct installMethod * method,
             fullPath = alloca(strlen(host) + strlen(directory) + 2);
             sprintf(fullPath, "%s:%s", host, directory);
 
-            logMessage(INFO, "mounting nfs path %s", fullPath);
+            logMessage(INFO, "mounting nfs path %s, options '%s'", fullPath, mountOpts);
 
             if (FL_TESTING(flags)) {
                 stage = NFS_STAGE_DONE;
@@ -227,6 +237,7 @@ char * mountNfsImage(struct installMethod * method,
 
     free(host);
     free(directory);
+    free(mountOpts);
 
     return url;
 }
-- 
1.6.2.5


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