[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

udhcpc support for netcfg udeb



Howdy,

The following patch adds support for the udhcpc DHCP client to the
netcfg udeb.  It also simplifies the configuration file handling.
David, OK to commit?

Matt

Index: tools/netcfg/netcfg-dhcp.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/netcfg-dhcp.c,v
retrieving revision 1.9
diff -u -r1.9 netcfg-dhcp.c
--- tools/netcfg/netcfg-dhcp.c	2001/02/15 05:22:11	1.9
+++ tools/netcfg/netcfg-dhcp.c	2001/10/16 15:48:25
@@ -44,6 +44,7 @@
 {
   PUMP,
   DHCLIENT,
+  UDHCPC
 }
 dhcp_client_choices;
 
@@ -91,26 +92,10 @@
       fprintf (fp,
 	       "\n# This entry was created during the Debian installation\n");
       fprintf (fp, "iface %s inet dhcp\n", interface);
-      fclose (fp);
-    }
-  if (dhcp_client == DHCLIENT)
-    {
-
       if (dhcp_hostname)
-	if ((fp = file_open (DHCLIENT_FILE)))
-	  {
-	    fprintf (fp,
-		     "\n# dhclient configuration: created during the Debian installation\n\
-	    	      interface \"%s\" {\nsend host-name \"%s\";\n}\n",
-		     interface, dhcp_hostname);
-	    fclose (fp);
-	  }
+	fprintf (fp, "\thostname\t%s\n", dhcp_hostname);
+      fclose (fp);
     }
-  /* else if (dhcp_client == PUMP) {
-     nothing to do?
-     }
-   */
-
 }
 
 
@@ -122,15 +107,26 @@
   execlog ("/sbin/ifconfig lo 127.0.0.1");
   ptr = buf;
 
-  if (dhcp_client == PUMP)
+  switch (dhcp_client)
     {
-      ptr += snprintf (buf, sizeof (buf), "/sbin/pump -i %s", interface);
-      if (dhcp_hostname)
-	ptr +=
-	  snprintf (ptr, sizeof (buf) - (ptr - buf), " -h %s", dhcp_hostname);
+      case PUMP:
+	ptr += snprintf (buf, sizeof (buf), "/sbin/pump -i %s", interface);
+	if (dhcp_hostname)
+	  ptr += snprintf (ptr, sizeof (buf) - (ptr - buf), " -h %s",
+			   dhcp_hostname);
+	break;
+
+      case DHCLIENT:
+	ptr += snprintf (buf, sizeof (buf), "/sbin/dhclient %s", interface);
+	break;
+
+      case UDHCPC:
+	ptr += snprintf (buf, sizeof (buf), "/sbin/udhcpc -i %s -n", interface);
+	if (dhcp_hostname)
+	  ptr += snprintf (ptr, sizeof (buf) - (ptr - buf), " -H %s",
+			   dhcp_hostname);
+	break;
     }
-  else				/* dhcp_client == DHCLIENT */
-    ptr += snprintf (buf, sizeof (buf), "/sbin/dhclient %s", interface);
 
   if (execlog (buf))
     netcfg_die (client);
@@ -152,6 +148,8 @@
     dhcp_client = DHCLIENT;
   else if (stat ("/sbin/pump", &buf) == 0)
     dhcp_client = PUMP;
+  else if (stat ("/sbin/udhcpc", &buf) == 0)
+    dhcp_client = UDHCPC;
   else
     {
       client->command (client, "input", "critical", "netcfg/no_dhcp_client",
Index: tools/netcfg/netcfg.h
===================================================================
RCS file: /cvs/debian-boot/debian-installer/tools/netcfg/netcfg.h,v
retrieving revision 1.5
diff -u -r1.5 netcfg.h
--- tools/netcfg/netcfg.h	2001/02/15 05:22:11	1.5
+++ tools/netcfg/netcfg.h	2001/10/16 15:48:25
@@ -12,7 +12,6 @@
 #define NETWORKS_FILE   "/etc/networks"
 #define RESOLV_FILE     "/etc/resolv.conf"
 #define DHCPCD_FILE     "/etc/dhcpc/config"
-#define DHCLIENT_FILE	"/etc/dhclient.conf"
 #define DHCLIENT_DIR	"/var/dhcp"
 
 



Reply to: