[Frugalware-darcs] setup-current: netconfig: step4: set dns

VMiklos vmiklos at frugalware.org
Thu Mar 16 18:02:14 CET 2006


[netconfig: step4: set dns
VMiklos <vmiklos at frugalware.org>**20060118020330] {
hunk ./src/config/netconfig.c 182
-	/*printf("interfaces found:\n");
-	for (i=0; i<g_list_length(profile->interfaces); i++)
+	/*printf("dnses found:\n");
+	for (i=0; i<g_list_length(profile->dnses); i++)
hunk ./src/config/netconfig.c 185
-		iface = (interface_t*)g_list_nth_data(profile->interfaces, i);
-		printf("name: %s\n", iface->name);
-		printf("%s\n", iface->mac);
+		printf("addr: %s\n", (char*)g_list_nth_data(profile->dnses, i));
hunk ./src/config/netconfig.c 207
-	FILE *input = stdin;
+	FILE *fp=NULL, *input = stdin;
hunk ./src/config/netconfig.c 250
-				FILE *fp;
hunk ./src/config/netconfig.c 324
+		}
+		// step4: set dns
+		if(g_list_length(profile->dnses))
+		{
+			if(!nco_dryrun)
+				fp = fopen("/etc/resolv.conf", "w");
+			if(nco_dryrun || (fp != NULL))
+			{
+				for (i=0; i<g_list_length(profile->dnses); i++)
+					if(nco_dryrun)
+						printf("nameserver %s\n", (char*)g_list_nth_data(profile->dnses, i));
+					else
+						fprintf(fp, "nameserver %s\n", (char*)g_list_nth_data(profile->dnses, i));
+				if(!nco_dryrun)
+					fclose(fp);
+			}
}


More information about the Frugalware-darcs mailing list