]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/install+setup/install/nic.c
Openmailadmin integriert.
[ipfire-2.x.git] / src / install+setup / install / nic.c
index 36c13a9b1a419581ad35536fa2c4fa04e4a8f0a2..966f7c84c0c165823f9179b85d12f44fadefa58a 100644 (file)
@@ -20,20 +20,18 @@ extern char *mylog;
 
 extern char **ctr;
 
-extern struct nic nics[];
+//extern struct nic nics[];
+//extern struct knic knics[];
 
 int networkmenu(struct keyvalue *ethernetkv)
 {
        int rc;
        char driver[STRING_SIZE] = "";
        char driveroptions[STRING_SIZE] = "";
-       struct keyvalue *kv = initkeyvalues();
        int result = 0;
        char commandstring[STRING_SIZE];
        char address[STRING_SIZE], netmask[STRING_SIZE];
        int done;
-       FILE *handle;
-       char line[STRING_SIZE];
        char description[1000];
        char message[1000];
        char title[STRING_SIZE];
@@ -46,41 +44,31 @@ int networkmenu(struct keyvalue *ethernetkv)
                
                if (rc == 0 || rc == 1)
                {
-                       sprintf(commandstring, "/bin/probenic.sh 1");
-                       sprintf(message, ctr[TR_PROBING_FOR_NICS]);
-                       runcommandwithstatus(commandstring, message);
-
-                       if ((handle = fopen("/nicdriver", "r")))
+                       probecards(driver, driveroptions);
+                       if (!strlen(driver))
+                               errorbox(ctr[TR_PROBE_FAILED]);
+                       else
                        {
-                               char *driver;
-                               fgets(line, STRING_SIZE-1, handle);
-                               fclose(handle);
-                               line[strlen(line) - 1] = 0;
-                               driver = strtok(line, ".");
-                               fprintf(flog, "Detected NIC driver: %s\n",driver);
-                               if (strlen(driver) > 1) {
-                                       strcpy(driveroptions, "");
-                                       findnicdescription(driver, description);
-                                       sprintf (title, "%s %s - %s", NAME, VERSION, SLOGAN);
-                                       sprintf(message, ctr[TR_FOUND_NIC], NAME, description);
-                                       newtWinMessage(title, ctr[TR_OK], message);
-                               } else {
-                                       errorbox(ctr[TR_PROBE_FAILED]);
-                               }
-                       }
+                               //findnicdescription(driver, description);
+                               sprintf (title, "%s v%s - %s", NAME, VERSION, SLOGAN);
+                               sprintf(message, ctr[TR_FOUND_NIC], NAME, description);
+                               newtWinMessage(title, ctr[TR_OK], message);
+                       }               
                }
-               else if (rc == 2)
-                       choosecards(driver, driveroptions);
                else
+                       done = 1;       
+                       
+               if (strlen(driver))
                        done = 1;
        }
+       
+       if (!strlen(driver))
+               goto EXIT;
 
        /* Default is a GREEN nic only. */
        /* Smoothie is not untarred yet, so we have to delay actually writing the
         * settings till later. */
        replacekeyvalue(ethernetkv, "CONFIG_TYPE", "0");
-       replacekeyvalue(ethernetkv, "GREEN_DRIVER", driver);
-       replacekeyvalue(ethernetkv, "GREEN_DRIVER_OPTIONS", driveroptions);
        replacekeyvalue(ethernetkv, "GREEN_DEV", "eth0");
        replacekeyvalue(ethernetkv, "GREEN_DISPLAYDRIVER", driver);
        
@@ -90,7 +78,7 @@ int networkmenu(struct keyvalue *ethernetkv)
        strcpy(address, ""); findkey(ethernetkv, "GREEN_ADDRESS", address);
        strcpy(netmask, ""); findkey(ethernetkv, "GREEN_NETMASK", netmask);
 
-       snprintf(commandstring, STRING_SIZE, "/bin/ifconfig eth0 %s netmask %s up", 
+       snprintf(commandstring, STRING_SIZE, "/sbin/ifconfig eth0 %s netmask %s up", 
                address, netmask);
        if (mysystem(commandstring))
        {
@@ -101,8 +89,6 @@ int networkmenu(struct keyvalue *ethernetkv)
        result = 1;
        
 EXIT:
-       freekeyvalues(kv);
        
        return result;
 }
-