From: Roy Marples Date: Thu, 8 Nov 2007 10:37:52 +0000 (+0000) Subject: Work with the BSD RC system too. X-Git-Tag: v3.2.3~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a10f57d079aa93afbc58d3ccaeeee1ddfc35bd01;p=thirdparty%2Fdhcpcd.git Work with the BSD RC system too. --- diff --git a/ChangeLog b/ChangeLog index c83871c1..dde9ebd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +Work with the BSD RC system too. Find resolvconf in path instead of /sbin. make HAVE_FORK=yes|no should be used if cross compiling. Implement an exponential NAK backoff. diff --git a/Makefile b/Makefile index 1003a48c..fd8042cb 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,11 @@ _HAVE_FORK_SH = if [ "$(HAVE_FORK)" = "yes" ]; then \ _HAVE_FORK != $(_HAVE_FORK_SH) FORK = $(_HAVE_FORK)$(shell $(_HAVE_FORK_SH)) +# Work out if we use ORC or RC +_RC_SH = if [ -d /etc/init.d ]; then echo "-DENABLE_ORC"; elif [ -d /etc/rc.d ]; then echo "-DENABLE_RC"; fi +_RC != $(_RC_SH) +RC = $(_RC)$(shell $(_RC_SH)) + # pmake check for extra cflags WEXTRA != for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \ if $(CC) -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ @@ -95,7 +100,7 @@ dhcpcd_OBJS = arp.o client.o common.o configure.o dhcp.o dhcpcd.o duid.o \ info.o interface.o ipv4ll.o logger.o signals.o socket.o $(dhcpcd_OBJS): - $(CC) $(FORK) $(CFLAGS) -c $*.c + $(CC) $(FORK) $(RC) $(CFLAGS) -c $*.c dhcpcd: $(dhcpcd_H) .depend $(dhcpcd_OBJS) $(CC) $(LDFLAGS) $(dhcpcd_OBJS) $(LIBRESOLV) $(LIBRT) -o dhcpcd diff --git a/config.h b/config.h index 1ee317d4..6849943b 100644 --- a/config.h +++ b/config.h @@ -29,35 +29,28 @@ * See RFC 3315 for details on this. */ #define ENABLE_DUID +/* resolvconf is framework for multiple interfaces to manage resolv.conf */ +#define ENABLE_RESOLVCONF + /* Some systems do not have a working fork. * The Makefile will attempt to work it out, but if it fails to feel free to * define it here. */ // #define THERE_IS_NO_FORK -/* Packname name and pathname definitions. - * NOTE: The service restart commands are Gentoo specific and will - * probably need to be adapted for your OS. */ +/* Packname name and pathname definitions. */ #define PACKAGE "dhcpcd" -#define RESOLVCONF "/sbin/resolvconf" - #define ETCDIR "/etc" #define RESOLVFILE ETCDIR "/resolv.conf" #define NISFILE ETCDIR "/yp.conf" -#define NISSERVICE ETCDIR "/init.d/ypbind" -#define NISRESTARTARGS "--nodeps", "--quiet", "conditionalrestart" #define NTPFILE ETCDIR "/ntp.conf" #define NTPDRIFTFILE ETCDIR "/ntp.drift" #define NTPLOGFILE "/var/log/ntp.log" -#define NTPSERVICE ETCDIR "/init.d/ntpd" -#define NTPRESTARTARGS "--nodeps", "--quiet", "conditionalrestart" #define OPENNTPFILE ETCDIR "/ntpd.conf" -#define OPENNTPSERVICE ETCDIR "/init.d/ntpd" -#define OPENNTPRESTARTARGS "--nodeps", "--quiet", "conditionalrestart" #define DEFAULT_SCRIPT ETCDIR "/" PACKAGE ".sh" @@ -69,4 +62,25 @@ #define DUIDFILE CONFIGDIR "/" PACKAGE ".duid" +/* ORC is the Open Run Control, forked from Gentoo's baselayout package + * RC is a BSD style Run Control system */ +#ifdef ENABLE_ORC +#define NISSERVICE ETCDIR "/init.d/ypbind" +#define NISRESTARTARGS "--nodeps", "--quiet", "conditionalrestart" +#define NTPSERVICE ETCDIR "/init.d/ntpd" +#define NTPRESTARTARGS "--nodeps", "--quiet", "conditionalrestart" +#define OPENNTPSERVICE ETCDIR "/init.d/ntpd" +#define OPENNTPRESTARTARGS "--nodeps", "--quiet", "conditionalrestart" +#elif ENABLE_RC +#define NISSERVICE ETCDIR "/rc.d/ypbind" +#define NISRESTARTARGS "restart" +#define NTPSERVICE ETCDIR "/rc.d/ntpd" +#define NTPRESTARTARGS "restart" +#define OPENNTPSERVICE ETCDIR "/rc.d/ntpd" +#define OPENNTPRESTARTARGS "restart" +#else +#undef ENABLE_NIS +#undef ENABLE_NTP +#endif + #endif diff --git a/dhcpcd.c b/dhcpcd.c index 54681c8f..b5e47d20 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -5,8 +5,6 @@ * Distributed under the terms of the GNU General Public License v2 */ -const char copyright[] = "Copyright (c) 2006-2007 Roy Marples"; - /* We need to define this to get kill on GNU systems */ #ifdef __linux__ #define _BSD_SOURCE @@ -403,6 +401,14 @@ int main(int argc, char **argv) #ifdef ENABLE_NTP " NTP" #endif +#ifdef ENABLE_ORC + " ORC" +#elif ENABLE_RC + " RC" +#endif +#ifdef ENABLE_RESOLVCONF + " RESOLVCONF" +#endif #ifdef THERE_IS_NO_FORK " THERE_IS_NO_FORK" #endif