]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Work with the BSD RC system too.
authorRoy Marples <roy@marples.name>
Thu, 8 Nov 2007 10:37:52 +0000 (10:37 +0000)
committerRoy Marples <roy@marples.name>
Thu, 8 Nov 2007 10:37:52 +0000 (10:37 +0000)
ChangeLog
Makefile
config.h
dhcpcd.c

index c83871c15e91013f622fd65d77c7728dfd7b5cb0..dde9ebd3974ede4a151f7bb96e7e6e7028697ac3 100644 (file)
--- 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.
index 1003a48c8f52edda183db1e3c960f57f7e27a683..fd8042cb2bb1f824a94e868f9fd240527e86a04b 100644 (file)
--- 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
index 1ee317d439b75e9faf1687f57124f246c20f3a40..6849943b0cc4796e3218a137fba5863580a6e32a 100644 (file)
--- a/config.h
+++ b/config.h
  * 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"
 
 
 #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
index 54681c8fd7f64e8832b8367dc486dac71c1b9e81..b5e47d202c0ddc80a1803c68cbf17195eac5c229 100644 (file)
--- 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