]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/install+setup/setup/networking.c
Setup weiter ausgebaut.
[people/pmueller/ipfire-2.x.git] / src / install+setup / setup / networking.c
index 6bac6b60844ef9cb1e754b4e7788bf212f8c8054..6a2bb128fc3b8f43115456f91d60fbdbe838fb03 100644 (file)
@@ -41,7 +41,7 @@ int configtypecards[] = {
        2,      // "GREEN + RED",
        3,      // "GREEN + RED + ORANGE",
        3,      // "GREEN + RED + BLUE",
-       4       // "GREEN + RED + ORANGE + BLUE",
+       4         // "GREEN + RED + ORANGE + BLUE",
 };
 
 
@@ -134,8 +134,8 @@ int oktoleave(char *errormessage)
                return 0;
        }       
 
-       strcpy(temp, "0"); findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
-       if (configtype < 1 || configtype > 4) configtype = 0;
+       strcpy(temp, "1"); findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
+       if (configtype < 1 || configtype > 4) configtype = 1;
 
        if (HAS_GREEN)
        {
@@ -147,7 +147,7 @@ int oktoleave(char *errormessage)
                }
                if (!(interfacecheck(kv, "GREEN")))
                {
-                       strcpy(errormessage, "(TR) GRÜNE IP nicht konfiguriert.\n"); //ctr[TR_MISSING_GREEN_IP]);
+                       strcpy(errormessage, ctr[TR_MISSING_GREEN_IP]);
                        goto EXIT;
                }
        }
@@ -198,13 +198,13 @@ int oktoleave(char *errormessage)
                strcpy(temp, ""); findkey(kv, "DNS1", temp);
                if (!(strlen(temp)))
                {
-                       strcpy(errormessage, "(TR) Kein DNS eingetragen\n");
+                       strcpy(errormessage, ctr[TR_MISSING_DNS]);
                        goto EXIT;
                }
                strcpy(temp, ""); findkey(kv, "DEFAULT_GATEWAY", temp);
                if (!(strlen(temp)))
                {
-                       strcpy(errormessage, "(TR) Kein default Gateway eingetragen.\n");
+                       strcpy(errormessage, ctr[TR_MISSING_DEFAULT]);
                        goto EXIT;
                }
        }
@@ -230,7 +230,7 @@ int firstmenu(void)
        static int choice = 0;
        struct keyvalue *kv = initkeyvalues();
        char message[1000];
-       char temp[STRING_SIZE];
+       char temp[STRING_SIZE] = "1";
        int x;
        int result;
        char networkrestart[STRING_SIZE] = "";
@@ -245,8 +245,10 @@ int firstmenu(void)
        if (netaddresschange) 
                strcpy(networkrestart, ctr[TR_RESTART_REQUIRED]);
 
-       strcpy(temp, ""); findkey(kv, "CONFIG_TYPE", temp); x = atol(temp);
-       if (x < 1 || x > 4) x = 0;
+       strcpy(temp, ""); findkey(kv, "CONFIG_TYPE", temp); 
+       x = atol(temp);
+       x--;
+       if (x < 0 || x > 4) x = 0;
        /* Format heading bit. */
        snprintf(message, 1000, ctr[TR_CURRENT_CONFIG], configtypenames[x],
                networkrestart);
@@ -265,12 +267,10 @@ int firstmenu(void)
 int configtypemenu(void)
 {
        struct keyvalue *kv = initkeyvalues();
-       char temp[STRING_SIZE] = "0";
+       char temp[STRING_SIZE] = "1";
        char message[1000];
        int choise, found;
-       int rc;
-
-       fprintf(flog,"Enter ConfigMenu\n");
+       int rc, configtype;
 
        if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
        {
@@ -282,6 +282,7 @@ int configtypemenu(void)
        found = scan_network_cards();
        
        findkey(kv, "CONFIG_TYPE", temp); choise = atol(temp);
+       choise--;
 
        do
        {
@@ -289,7 +290,7 @@ int configtypemenu(void)
                rc = newtWinMenu(ctr[TR_NETWORK_CONFIGURATION_TYPE], message, 50, 5, 5,
                        6, configtypenames, &choise, ctr[TR_OK], ctr[TR_CANCEL], NULL);
                if ( configtypecards[choise] > found ) {
-                       sprintf(message, "(TR) Nicht genuegend Netzwerkkarten fuer diese Auswahl gefunden.\n\nBenoetigt: %d\nGefunden: %d\n", configtypecards[choise], found);
+                       sprintf(message, ctr[TR_NOT_ENOUGH_INTERFACES] , configtypecards[choise], found);
                        errorbox(message);
                }
        }
@@ -300,9 +301,13 @@ int configtypemenu(void)
                choise++;
                sprintf(temp, "%d", choise);
                replacekeyvalue(kv, "CONFIG_TYPE", temp);
-               clear_card_entry(_RED_CARD_);
-               clear_card_entry(_ORANGE_CARD_);
-               clear_card_entry(_BLUE_CARD_);
+               configtype = atol(temp);
+               if (!HAS_RED)
+                       clear_card_entry(_RED_CARD_);
+               if (!HAS_ORANGE)
+                       clear_card_entry(_ORANGE_CARD_);
+               if (!HAS_BLUE)
+                       clear_card_entry(_BLUE_CARD_);
 
                writekeyvalues(kv, CONFIG_ROOT "/ethernet/settings");
                netaddresschange = 1;
@@ -312,17 +317,15 @@ int configtypemenu(void)
        return 0;
 }
 
-
-
 /* Driver menu.  Choose drivers.. */
 int drivermenu(void)
 {
        struct keyvalue *kv = initkeyvalues();
        char message[STRING_SIZE];
-       char temp[STRING_SIZE];
+       char temp[STRING_SIZE] = "1";
 
        int configtype;
-       int i, rc, kcount = 0, neednics; //i = 0, count = 0,
+       int i, rc, kcount = 0, neednics;
 
        if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
        {
@@ -331,13 +334,13 @@ int drivermenu(void)
                return 0;
        }
 
-       strcpy(temp, "0"); findkey(kv, "CONFIG_TYPE", temp);
+       findkey(kv, "CONFIG_TYPE", temp);
        configtype = atol(temp);
        
        strcpy(message, ctr[TR_CONFIGURE_NETWORK_DRIVERS]);
 
-       kcount = 0;     // counter to find knowing nics.
-       neednics = 0;   // counter to use needing nics.
+       kcount = 0;
+       neednics = 0;
        if (HAS_GREEN) {
                sprintf(temp, "GREEN:  %s\n", knics[_GREEN_CARD_].description);
                strcat(message, temp);
@@ -375,7 +378,9 @@ int drivermenu(void)
                neednics++;
        }
 
-       for ( i=0 ; i<4;i++) if (strcmp(knics[i].macaddr, "")) kcount++;
+       for ( i=0 ; i<4; i++)
+               if (strcmp(knics[i].macaddr, ""))
+                       kcount++;
 
        if (neednics = kcount)
        {
@@ -384,11 +389,9 @@ int drivermenu(void)
                ctr[TR_CANCEL], message);
                if (rc == 0 || rc == 1)
                {
-                       /* Shit, got to do something.. */
                        changedrivers();
                }
        } else {
-               /* Shit, got to do something.. */
                changedrivers();
        }
        freekeyvalues(kv);
@@ -418,8 +421,9 @@ int changedrivers(void)
                errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
                return 0;
        }
-       runcommandwithstatus("/etc/rc.d/init.d/network stop red blue orange",
-               ctr[TR_PUSHING_NON_LOCAL_NETWORK_DOWN]);
+       if (automode == 0)
+               runcommandwithstatus("/etc/rc.d/init.d/network stop red blue orange",
+                       ctr[TR_PUSHING_NON_LOCAL_NETWORK_DOWN]);
 
        findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
        if (configtype == 1)
@@ -434,7 +438,7 @@ int changedrivers(void)
        do
        {
                count = 0;
-               strcpy(message, "(TR) Bitte wählen Sie das Interface aus das geaendert werden soll.\n\n");
+               strcpy(message, ctr[TR_INTERFACE_CHANGE]);
 
                if (green) {
                        strcpy(MenuInhalt[count], "GREEN");
@@ -489,7 +493,7 @@ int changedrivers(void)
                }
                pMenuInhalt[count] = NULL;
 
-               rc = newtWinMenu("(TR) Netcard Farbe", message, 70, 5, 5, 6, pMenuInhalt, &choise, ctr[TR_SELECT], "(TR) Entfernen" , ctr[TR_DONE], NULL);
+               rc = newtWinMenu( ctr[TR_NETCARD_COLOR], message, 70, 5, 5, 6, pMenuInhalt, &choise, ctr[TR_SELECT], ctr[TR_REMOVE], ctr[TR_DONE], NULL);
                        
                if ( rc == 0 || rc == 1) {
                        if ((green) && ( choise == NicEntry[0])) nicmenu(_GREEN_CARD_);