From: casemaster Date: Tue, 12 Jun 2007 20:11:00 +0000 (+0000) Subject: Die Datei "/etc/udev/rules.d/30-persistent-network.rules" wird jetzt X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=84e975baf56e62918243af248fec036f70228503;p=people%2Fteissler%2Fipfire-2.x.git Die Datei "/etc/udev/rules.d/30-persistent-network.rules" wird jetzt beim Verlassen der NW-Konfiguration in einen Stück geschrieben. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@626 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/src/install+setup/libsmooth/libsmooth.h b/src/install+setup/libsmooth/libsmooth.h index c19f5bdac..b9ffe2157 100644 --- a/src/install+setup/libsmooth/libsmooth.h +++ b/src/install+setup/libsmooth/libsmooth.h @@ -94,6 +94,7 @@ int gettype(char *type); int setnetaddress(struct keyvalue *kv, char *colour); void networkdialogcallbacktype(newtComponent cm, void *data); int interfacecheck(struct keyvalue *kv, char *colour); +int create_udev(void); int scan_network_cards(void); int nicmenu(int colour); int clear_card_entry(int cards); diff --git a/src/install+setup/libsmooth/netstuff.c b/src/install+setup/libsmooth/netstuff.c index 5aee7e03b..5fa07d37e 100644 --- a/src/install+setup/libsmooth/netstuff.c +++ b/src/install+setup/libsmooth/netstuff.c @@ -366,18 +366,37 @@ void strupper(unsigned char *string) } */ -int write_configs_netudev(int card , int colour) -{ + +int create_udev(void) +{ #define UDEV_NET_CONF "/etc/udev/rules.d/30-persistent-network.rules" FILE *fp; + int i; + + fprintf(flog,"Enter create_udev: "UDEV_NET_CONF"\n"); // #### Debug #### + if ( (fp = fopen(UDEV_NET_CONF, "w")) == NULL ) { + fprintf(stderr,"Couldn't open" UDEV_NET_CONF); + return 1; + } + + for (i = 0 ; i < 4 ; i++) + { + if (strcmp(knics[i].macaddr, "")) { + fprintf(fp,"ACTION==\"add\", SUBSYSTEM==\"net\", SYSFS{address}==\"%s\", NAME=\"%s0\" # %s\n", knics[i].macaddr, lcolourcard[i], knics[i].description); + fprintf(flog,"Write %s\n",lcolourcard[i]); // #### Debug #### + } + } + fclose(fp); + return 0; +} + +int write_configs_netudev(int card , int colour) +{ char commandstring[STRING_SIZE]; struct keyvalue *kv = initkeyvalues(); char temp1[STRING_SIZE], temp2[STRING_SIZE], temp3[STRING_SIZE]; char ucolour[STRING_SIZE]; -// sprintf(ucolour, colour); -// strupper(ucolour); - sprintf(ucolour, ucolourcard[colour]); strcpy(knics[colour].driver, nics[card].driver); strcpy(knics[colour].description, nics[card].description); @@ -403,24 +422,6 @@ int write_configs_netudev(int card , int colour) writekeyvalues(kv, CONFIG_ROOT "/ethernet/settings"); freekeyvalues(kv); - // Make sure that there is no conflict - snprintf(commandstring, STRING_SIZE, "/usr/bin/touch "UDEV_NET_CONF" >/dev/null 2>&1"); - system(commandstring); - -// snprintf(commandstring, STRING_SIZE, "/bin/cat "UDEV_NET_CONF" | /bin/grep -v \"%s\" > "UDEV_NET_CONF" 2>/dev/null", macaddr); -// system(commandstring); - - snprintf(commandstring, STRING_SIZE, "/bin/cat "UDEV_NET_CONF" | /bin/grep -v \"%s0\" > "UDEV_NET_CONF" 2>/dev/null", lcolourcard[colour]); - system(commandstring); - - if( (fp = fopen(UDEV_NET_CONF, "a")) == NULL ) - { - fprintf(stderr,"Couldn't open" UDEV_NET_CONF); - return 1; - } - fprintf(fp,"ACTION==\"add\", SUBSYSTEM==\"net\", SYSFS{address}==\"%s\", NAME=\"%s0\" # %s\n", nics[card].macaddr, lcolourcard[colour], nics[card].description); - fclose(fp); - return 0; } @@ -497,12 +498,7 @@ int nicmenu(int colour) if ( strlen(nics[i].description) < 55 ) sprintf(MenuInhalt[mcount], "%.*s", strlen(nics[i].description)-2, nics[i].description+1); else { - fprintf(flog,"Modify string 4 display.\n"); // #### Debug #### sprintf(cMenuInhalt, "%.50s", nics[i].description + 1); - fprintf(flog,"1: %s\n"); // #### Debug #### -// strncpy(MenuInhalt[mcount], cMenuInhalt,(strrchr(cMenuInhalt,' ') - cMenuInhalt)); -// sprintf(MenuInhalt[mcount], "%.*s", strlen(strrchr(cMenuInhalt,' ')), cMenuInhalt); - strrchr(cMenuInhalt,' '); sprintf(MenuInhalt[mcount], cMenuInhalt); strcat (MenuInhalt[mcount], "..."); } diff --git a/src/install+setup/setup/networking.c b/src/install+setup/setup/networking.c index 90cdf7068..b2e51033c 100644 --- a/src/install+setup/setup/networking.c +++ b/src/install+setup/setup/networking.c @@ -136,7 +136,7 @@ int handlenetworking(void) ctr[TR_PULLING_NETWORK_UP]); } } - + create_udev(); return 1; }