Browse Source

only run if num_interfaces > 1

r21505
tags/1.03
Joshua Kwan 17 years ago
parent
commit
6a033d3793
3 changed files with 11 additions and 9 deletions
  1. +2
    -1
      debian/netcfg-common.templates
  2. +1
    -1
      netcfg-common.c
  3. +8
    -7
      netcfg.c

+ 2
- 1
debian/netcfg-common.templates View File

@@ -32,7 +32,8 @@ Choices: ${ifchoices}
Default: ${ifdefault}
_Description: Primary network interface:
Your system has multiple network interfaces. Choose the one to use as
the primary network interface while installing Debian.
the primary network interface while installing Debian. If possible, the
first connected network interface found has been selected.

Template: netcfg/wireless_essid
Type: string


+ 1
- 1
netcfg-common.c View File

@@ -392,7 +392,7 @@ int netcfg_get_interface(struct debconfclient *client, char **interface,
}
di_snprintfcat(ptr, len, "%s: %s, ", inter, ifdsc);

if (!strcmp(defif, inter))
if (num_interfaces > 1 && !strcmp(defif, inter))
debconf_subst(client, "netcfg/get_interfaces", "ifdefault", ptr);

free(ifdsc);


+ 8
- 7
netcfg.c View File

@@ -93,16 +93,17 @@ int main(int argc, char *argv[])
return 10;
case GET_INTERFACE:
/* Choose a default from ethtool-lite */
get_all_ifs(1, &ifaces);
while (*ifaces)
if (get_all_ifs(1, &ifaces) > 1)
{
if (ethtool_lite (*ifaces) == 1) /* CONNECTED */
while (*ifaces)
{
defiface = strdup(*ifaces);
break;
if (ethtool_lite (*ifaces) == 1) /* CONNECTED */
{
defiface = strdup(*ifaces);
break;
}
ifaces++;
}
ifaces++;
}
if(netcfg_get_interface(client, &interface, &num_interfaces, defiface))


Loading…
Cancel
Save