Re: [PATCH] Enable dhcpcd instead of dhclient

Michael Biebl wrote:
Roy Marples wrote:
On Thu, 2008-07-17 at 10:14 -0400, Dan Williams wrote:
I don't have a problem with that.  So lets:

1) if given a full path that ends in dhclient or dhcpcd, don't do
further checks just use that
2) Document the required versions in the README
3) If nothing is found or specified, default to dhclient since that's
what it's been up until now

Sounds good to me.

Roy, will you write a patch for that?

Atttached is a patch for 1 and 3.
If no dhcp client is found, default to /sbin/dhclient and warn about it.
If a full path is given then don't check version, just use it. But do check we have a backend .c file for it.

I didn't do 2 as NM doesn't have a requirements file I could find.



---	(revision 3912)
+++	(working copy)
@@ -336,7 +336,14 @@
 # DHCP client
 AC_ARG_WITH([dhcp-client], AS_HELP_STRING([--with-dhcp-client=dhcpcd|dhclient], [path to the chosen dhcp client]))
-if test "x$with_dhcp_client" = "x" || test x`basename "$with_dhcp_client"` = "xdhclient"; then
+# If a full path is given, use that and do not test if it works or not.
+case "${with_dhcp_client}" in
+	/*)
+		DHCP_CLIENT_PATH="${with_dhcp_client}"
+		AC_MSG_NOTICE(using the DHCP client ${DHCP_CLIENT_PATH})
+		;;
+if test "x$with_dhcp_client" = "x" -a "x$DHCP_CLIENT_PATH" != "x" || test x`basename "$with_dhcp_client"` = "xdhclient"; then
 	# We only work with ISC dhclient - the FreeBSD and OpenBSD derivatives don't have the same userland.
 	AC_MSG_CHECKING(for dhclient)
 	for client in "$with_dhcp_client" /sbin/dhclient /usr/pkg/sbin/dhclient /usr/local/sbin/dhclient; do
@@ -353,7 +360,7 @@
-if test "x$with_dhcp_client" = "x" -a "x$DHCP_CLIENT_PATH" = "x" || test x`basename "$with_dhcp_client"` = "xdhcpcd"; then
+if test "x$with_dhcp_client" = "x" -a "x$DHCP_CLIENT_PATH" != "x" || test x`basename "$with_dhcp_client"` = "xdhcpcd"; then
 	# We fully work with upstream dhcpcd-4
 	AC_MSG_CHECKING([for dhcpcd])
 	for client in "$with_dhcp_client" /sbin/dhcpcd /usr/pkg/sbin/dhcpcd /usr/local/sbin/dhcpcd; do
@@ -372,10 +379,18 @@
 if test "x$DHCP_CLIENT_PATH" = "x"; then
-	AC_MSG_ERROR([Could not find a suitable DHCP client])
+	# DHCP clients are not a build time dependency, only runtime.
+	# dhclient has been the longtime default for NM and it's in /sbin
+	# in most distros, so use it.
+	AC_MSG_WARN([Could not find a suitable DHCP client])
+	DHCP_CLIENT_PATH=/sbin/dhclient
+	AC_MSG_WARN([Falling back to ISC dhclient, ${DHCP_CLIENT_PATH}])
+if ! test -f src/dhcp-manager/nm-dhcp-"${DHCP_CLIENT}".c; then
+	AC_MSG_ERROR([No backend for the DHCP client ${DHCP_CLIENT}])

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