On Thu, Jan 24, 2002 at 11:56:31AM +1000, Anthony Towns wrote:
> The "auto" line probably shouldn't appear for PCMCIA cards. (auto means
> "configure this interface at bootup", whereas PCMCIA cards are only
> configured when the card's inserted)
Thanks for pointing that out. Could someone please test the
following patch?
Matt
Index: netconfig.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/netconfig.c,v
retrieving revision 1.80
diff -u -p -r1.80 netconfig.c
--- netconfig.c 2002/01/03 19:19:54 1.80
+++ netconfig.c 2002/01/24 16:04:05
@@ -32,8 +32,6 @@
#define NC_ETC_NETWORK_DIR "/etc/network"
#define NC_INTERFACES_FILE "/etc/network/interfaces"
#define NC_HOSTS_FILE "/etc/hosts"
-#define NC_PCMCIA_DIR "/etc/pcmcia"
-#define NC_PCMCIA_FILE "/etc/pcmcia/network.opts"
/*
Use 2.2.x because dhclient forces -q (quiet) and I like logging.
Using dhclient would make adding 2.0.x support just a matter of
@@ -634,73 +632,6 @@ int write_common_network() {
}
-#ifdef PCMCIA
-/*
- * Write the PCMCIA network configuration (static and DHCP)
- */
-int write_pcmcia_network() {
- FILE *p_file;
- char *tmp, *ns, *aux;
- const char* path;
- int ix;
-
- path = target_path(NC_PCMCIA_DIR);
- if (check_dir(path) == -1) mkdir(path, 0755);
-
- if ((p_file = fopen(target_path(NC_PCMCIA_FILE), "w"))) {
- fprintf(p_file, "# Network adapter configuration\n#\n# Automatically generated during the Debian installation\n#\n");
- fprintf(p_file, "# The address format is \"scheme,socket,instance,hwaddr\".\n#\ncase \"$ADDRESS\" in\n*,*,*,*)\n");
- fprintf(p_file, "\t# Transceiver selection, for some cards -- see 'man ifport'\n");
- if (transceiver) {
- fprintf(p_file, "\tIF_PORT=\"%s\"\n", transceiver);
- } else {
- fprintf(p_file, "\tIF_PORT=\"\"\n");
- }
- if(use_dhcp) {
- if( NAME_ISEXE( NC_DHCLIENT_FILE, &nc_statbuf ))
- fprintf(p_file, "\tDHCLIENT=\"y\"\n");
- else
- fprintf(p_file, "\tPUMP=\"y\"\n");
- } else {
- fprintf(p_file, "\tPUMP=\"n\"\n");
- fprintf(p_file, "\t# Host's IP address, netmask, network address, broadcast address\n");
- fprintf(p_file, "\tIPADDR=\"%s\"\n", IP4tostr(prtbuf, ipaddr));
- fprintf(p_file, "\tNETMASK=\"%s\"\n", IP4tostr(prtbuf, netmask));
- fprintf(p_file, "\tNETWORK=\"%s\"\n", IP4tostr(prtbuf, network));
- fprintf(p_file, "\tBROADCAST=\"%s\"\n", IP4tostr(prtbuf, broadcast));
- if (has_gw) {
- fprintf(p_file, "\tGATEWAY=\"%s\"\n", IP4tostr(prtbuf, gateway));
- } else {
- fprintf(p_file, "\tGATEWAY=\"\"\n");
- }
- if (domain) {
- fprintf(p_file, "\tDOMAIN=\"%s\"\n", domain);
- }
- if (nameserver) {
- aux = ns = strdup(nameserver);
- ix = 1;
- while ((tmp = strchr(ns, ' ')) != NULL) {
- *tmp = '\0';
- tmp++;
- fprintf(p_file, "\tDNS_%d=\"%s\"\n", ix, ns);
- ns = tmp;
- ix++;
- }
- fprintf(p_file, "\tDNS_%d=\"%s\"\n", ix, ns);
- free(aux);
- } else {
- fprintf(p_file, "\tDNS_1=\"\"\n");
- }
- }
- fprintf(p_file, "\t;;\nesac\n");
- fclose(p_file);
- return 0;
- } else {
- return 255;
- }
-}
-
-#endif /* PCMCIA */
/*
* Write the static network configuration
@@ -756,36 +687,29 @@ int write_static_network() {
} else {
ret = 255;
}
-#ifdef PCMCIA
- /*
- * Only write /etc/network/interfaces if we have a non-PCMCIA interface.
- */
- if (has_pcmcia) {
- ret = write_pcmcia_network();
- } else
-#endif /* PCMCIA */
- {
- if ((p_file = fopen(target_path(NC_INTERFACES_FILE), "a"))) {
- fprintf(p_file, "\n# The first network card - this entry was created during the Debian installation\n");
- fprintf(p_file, "# (network, broadcast and gateway are optional)\n");
+
+ if ((p_file = fopen(target_path(NC_INTERFACES_FILE), "a"))) {
+ fprintf(p_file, "\n# The first network card - this entry was created during the Debian installation\n");
+ fprintf(p_file, "# (network, broadcast and gateway are optional)\n");
+ if (!has_pcmcia)
fprintf(p_file, "auto %s\n", netinterface);
- fprintf(p_file, "iface %s inet static\n", netinterface);
- fprintf(p_file, "\taddress %s\n", IP4tostr(prtbuf, ipaddr));
- fprintf(p_file, "\tnetmask %s\n", IP4tostr(prtbuf, netmask));
- if (!has_pointopoint) {
- fprintf(p_file, "\tnetwork %s\n", IP4tostr(prtbuf, network));
- fprintf(p_file, "\tbroadcast %s\n", IP4tostr(prtbuf, broadcast));
- } else {
- fprintf(p_file, "\tpointopoint %s\n", IP4tostr(prtbuf, peer));
- }
- if (has_gw) {
- fprintf(p_file, "\tgateway %s\n", IP4tostr(prtbuf, gateway));
- }
- fclose(p_file);
+ fprintf(p_file, "iface %s inet static\n", netinterface);
+ fprintf(p_file, "\taddress %s\n", IP4tostr(prtbuf, ipaddr));
+ fprintf(p_file, "\tnetmask %s\n", IP4tostr(prtbuf, netmask));
+ if (!has_pointopoint) {
+ fprintf(p_file, "\tnetwork %s\n", IP4tostr(prtbuf, network));
+ fprintf(p_file, "\tbroadcast %s\n", IP4tostr(prtbuf, broadcast));
} else {
- ret = 255;
+ fprintf(p_file, "\tpointopoint %s\n", IP4tostr(prtbuf, peer));
+ }
+ if (has_gw) {
+ fprintf(p_file, "\tgateway %s\n", IP4tostr(prtbuf, gateway));
}
+ fclose(p_file);
+ } else {
+ ret = 255;
}
+
return ret;
}
@@ -803,18 +727,12 @@ int write_dhcp_network() {
/* Copy /etc/resolv.conf (created by dhcp) to the target system */
vexeclog (LOG_DEBUG, "cp %s %s", NC_RESOLV_FILE, target_path(NC_RESOLV_FILE));
-#ifdef PCMCIA
- if (has_pcmcia) {
- write_pcmcia_network();
- } else
-#endif /* PCMCIA */
- {
- p_file = fopen(target_path(NC_INTERFACES_FILE), "a");
- fprintf(p_file, "\n# The first network card - this entry was created during the Debian installation\n");
+ p_file = fopen(target_path(NC_INTERFACES_FILE), "a");
+ fprintf(p_file, "\n# The first network card - this entry was created during the Debian installation\n");
+ if (!has_pcmcia)
fprintf(p_file, "auto %s\n", netinterface);
- fprintf(p_file, "iface %s inet dhcp\n", netinterface);
- fclose(p_file);
- }
+ fprintf(p_file, "iface %s inet dhcp\n", netinterface);
+ fclose(p_file);
return 0;
}
Attachment:
pgpeq6kZyagQ_.pgp
Description: PGP signature