diff --git a/config/install/halt b/config/install/halt index 666c27c64..bc823e3f9 100644 --- a/config/install/halt +++ b/config/install/halt @@ -1,5 +1,6 @@ #!/bin/sh # Clear screen +sleep 60 /bin/clear echo "Shutting down..." diff --git a/src/install+setup/libsmooth/libsmooth.h b/src/install+setup/libsmooth/libsmooth.h index 85c4dad1d..88ec00561 100644 --- a/src/install+setup/libsmooth/libsmooth.h +++ b/src/install+setup/libsmooth/libsmooth.h @@ -61,6 +61,7 @@ struct nic char driver[80]; char description[256]; char macaddr[20]; + char nic[20]; }; struct knic diff --git a/src/install+setup/libsmooth/netstuff.c b/src/install+setup/libsmooth/netstuff.c index e1a926d66..541437451 100644 --- a/src/install+setup/libsmooth/netstuff.c +++ b/src/install+setup/libsmooth/netstuff.c @@ -470,6 +470,54 @@ int write_configs_netudev(int card , int colour) return 0; } +char g_temp[STRING_SIZE]=""; +char* readmac(char *card) { + fprintf(flog,"Enter readmac... NIC: %s\n", card); // #### Debug #### + FILE *fp; + char temp[STRING_SIZE], mac[20]; + + sprintf(temp,"/sys/class/net/%s/address",card); + if( (fp = fopen(temp, "r")) == NULL ) { + fprintf(flog,"Couldn't open: %s\n",temp); + return NULL; + } + fgets(mac, 18, fp); + strtok(mac,"\n"); + fclose(fp); + strcpy(g_temp, mac); + return g_temp; +} + +char* find_nic4mac(char *findmac) { + fprintf(flog,"Enter find_name4nic... Search for %s\n", findmac); // #### Debug #### + #define SYSDIR "/sys/class/net" + + DIR *dir; + struct dirent *dirzeiger; + char temp[STRING_SIZE], temp2[STRING_SIZE]; + + if((dir=opendir(SYSDIR)) == NULL) { + fprintf(flog,"Fehler bei opendir (find_name4nic) ...\n"); + return NULL; + } + + sprintf(temp, ""); + while((dirzeiger=readdir(dir)) != NULL) { + if(*((*dirzeiger).d_name) != '.' & strcmp(((*dirzeiger).d_name), "lo") != 0) { + sprintf(temp2, "%s", readmac((*dirzeiger).d_name) ); + if (strcmp(findmac, temp2) == 0) { + sprintf(temp,"%s", (*dirzeiger).d_name); + fprintf(flog,"MAC: %s is NIC: %s\n", findmac, temp); // #### Debug #### + break; + } + } + } + + if(closedir(dir) == -1) fprintf(flog,"Fehler beim schliessen von %s\n", SYSDIR); + strcpy(g_temp, temp); + return g_temp; +} + int scan_network_cards(void) { FILE *fp; @@ -495,7 +543,10 @@ int scan_network_cards(void) if ( strncmp(temp_line, _driver, strlen(_driver)) == 0 ) sprintf(nics[count].driver, "%s", temp_line+strlen(_driver)); if ( strncmp(temp_line, _desc, strlen(_desc)) == 0 ) sprintf(nics[count].description, "%s", temp_line+strlen(_desc)); if ( strncmp(temp_line, _network_hwaddr, strlen(_network_hwaddr)) == 0 ) sprintf(nics[count].macaddr, "%s", temp_line+strlen(_network_hwaddr)); - if (strlen(nics[count].macaddr) > 15 ) count++; + if (strlen(nics[count].macaddr) > 15 ) { + sprintf(nics[count].nic, "%s", find_nic4mac(nics[count].macaddr)); + count++; + } } fclose(fp); scanned_nics_read_done = count; diff --git a/src/install+setup/setup/main.c b/src/install+setup/setup/main.c index 3bd5bf5b1..3e272716d 100644 --- a/src/install+setup/setup/main.c +++ b/src/install+setup/setup/main.c @@ -21,7 +21,7 @@ char **ctr = NULL; int automode = 0; -struct nic nics[20] = { { "" , "" , "" } }; +struct nic nics[20] = { { "" , "" , "" , "" } }; struct knic knics[20] = { { "" , "" , "" , "" } }; extern char *en_tr[];