]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Allow INFODIR to control where we keep our info files.
authorRoy Marples <roy@marples.name>
Wed, 14 Nov 2007 12:53:21 +0000 (12:53 +0000)
committerRoy Marples <roy@marples.name>
Wed, 14 Nov 2007 12:53:21 +0000 (12:53 +0000)
Respect MANPREFIX.

Makefile
README
config.h
dhcpcd.8.in [moved from dhcpcd.8 with 97% similarity]
dhcpcd.c

index 584512976154d442147cf71635d538701cb11e29..7554b232731d0987279248d3f00683f019daa2c5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,18 +3,19 @@
 # such as the need to link to libresolv and/or librt so please forgive the
 # embedded code :)
 
-VERSION = 3.1.8_pre1
+VERSION = 3.1.8pre1
 CFLAGS += -O2 -pipe
 
 INSTALL ?= install
 DESTDIR =
-SBINDIR = $(DESTDIR)/sbin
-MANDIR = $(DESTDIR)/usr/share/man
-LIBDIR = $(DESTDIR)/var/lib
+MANPREFIX ?= /usr/share
+SBINDIR = $(DESTDIR)$(PREFIX)/sbin
+MANDIR = $(DESTDIR)$(MANPREFIX)/man
+INFODIR = /var/lib/dhcpcd
 
 SBIN_TARGETS = dhcpcd
-MAN8_TARGETS = dhcpcd.8
-TARGET = $(SBIN_TARGETS)
+MAN_TARGETS = dhcpcd.8
+TARGET = $(SBIN_TARGETS) $(MAN_TARGETS)
 
 # Work out if we need -lresolv or not
 _LIBRESOLV_SH = printf '\#include <netinet/in.h>\n\#include <resolv.h>\nint main (void) { return (res_init ()); }\n' > .res_init.c; \
@@ -106,7 +107,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 signal.o socket.o
 
 $(dhcpcd_OBJS): 
-       $(CC) $(FORK) $(RC) $(CFLAGS) -c $*.c
+       $(CC) $(FORK) $(RC) -DINFODIR=\"$(INFODIR)\" $(CFLAGS) -c $*.c
 
 dhcpcd: $(dhcpcd_H) .depend $(dhcpcd_OBJS)
        $(CC) $(LDFLAGS) $(dhcpcd_OBJS) $(LIBRESOLV) $(LIBRT) -o dhcpcd
@@ -114,6 +115,11 @@ dhcpcd: $(dhcpcd_H) .depend $(dhcpcd_OBJS)
 version.h:
        echo '#define VERSION "$(VERSION)"' > version.h
 
+dhcpcd.8:
+       sed 's:/var/lib/dhcpcd:$(INFODIR):g' dhcpcd.8.in > dhcpcd.8
+
+man: $(MAN_TARGETS) 
+
 .PHONY: clean install dist
 
 # We always need to have a .depend file as not all make implentations can work
@@ -127,8 +133,7 @@ install: $(TARGET)
        $(INSTALL) -m 0755 -d $(SBINDIR)
        $(INSTALL) -m 0755 $(SBIN_TARGETS) $(SBINDIR)
        $(INSTALL) -m 0755 -d $(MANDIR)/man8
-       $(INSTALL) -m 0644 $(MAN8_TARGETS) $(MANDIR)/man8
-       $(INSTALL) -m 0755 -d $(LIBDIR)
+       $(INSTALL) -m 0644 $(MAN_TARGETS) $(MANDIR)/man8
 
 dist:
        $(INSTALL) -m 0755 -d /tmp/dhcpcd-$(VERSION)
diff --git a/README b/README
index 11e56c9152c5c42c99f962fa1ab1da567c9af17b..3d01f0e5585cd8ea94ccb7d14a69e82881e4e410 100644 (file)
--- a/README
+++ b/README
@@ -31,3 +31,6 @@ ORC      (OpenRC as used by Gentoo (forked from baselayout))
 BRC      (BSD RC system - /etc/rc.d/ntpd restart )
 SERVICE  (RedHat service command - service ntpd restart)
 SYSV     (SYSV style - /etc/init.d/ntpd restart)
+
+You can change the default dir where dhcpcd stores it's .info files with
+INFODIR=/var/db
index ac432cd25831210c3fca8ad3ebe9afafe1a45d2a..515b24cf72ef212d423541a9c6ededc5b48d6934 100644 (file)
--- a/config.h
+++ b/config.h
 #define STATEDIR            "/var"
 #define PIDFILE             STATEDIR "/run/" PACKAGE "-%s.pid"
 
-#define CONFIGDIR           STATEDIR "/lib/" PACKAGE
-#define INFOFILE            CONFIGDIR "/" PACKAGE "-%s.info"
-
-#define DUIDFILE            CONFIGDIR "/" PACKAGE ".duid"
+#ifndef INFODIR
+# define INFODIR            "/var/lib/dhcpcd"
+#endif
+#define INFOFILE            INFODIR "/" PACKAGE "-%s.info"
+#define DUIDFILE            INFODIR "/" PACKAGE ".duid"
 
 /* ORC is Open Run Control, forked from Gentoo's baselayout package
  * BRC is BSD style Run Control
similarity index 97%
rename from dhcpcd.8
rename to dhcpcd.8.in
index 9a734e4ec834141c2eca23231254bb7094d882b5..ddb717bbfe879a46c1194ce54f80621fbd2d46da 100644 (file)
--- a/dhcpcd.8
@@ -1,13 +1,7 @@
-.\" $Id$
-.\"
 .TH DHCPCD 8 "18 Jul 2007" "dhcpcd 3.1"
-
 .SH NAME
 dhcpcd \- DHCP client daemon
-
 .SH SYNOPSIS
-.in +.5i
-.ti -.5i
 dhcpcd
 \%[\-dknpAEGHMLNRTY]
 \%[\-c\ script]
@@ -22,7 +16,6 @@ dhcpcd
 \%[\-F\ none | ptr | both ]
 \%[\-I\ clientID ]
 \%[interface]
-.in -.5i
 .SH DESCRIPTION
 .B dhcpcd
 is an implementation of the DHCP client specified in
@@ -319,13 +312,6 @@ from replacing
 .I /etc/yp.conf
 
 .SH FILES
-.PD 0
-.TP
-.BI /var/lib/dhcpcd
-Directory used for storing files information files created by
-.B dhcpcd
-that can be used by shell scripts.
-.PD 1
 .TP
 .BI /etc/dhcpcd.sh
 script file, which
@@ -373,7 +359,13 @@ is actually replaced with the network interface name like
 to which
 .B dhcpcd
 is attached.
-
+.TP
+.BI /var/lib/dhcpcd/dhcpcd.duid
+file containing the generated DUID for dhcpcd to use.
+.TP
+.BI /var/lib/dhcpcd/dhcpcd-<interface>.info
+file containing information provided by the DHCP server than can be used in
+shell scripts.
 .SH SEE ALSO
 .LP
 .I Dynamic Host Configuration Protocol,
@@ -389,7 +381,7 @@ RFC 3927
 RFC 4702
 
 .SH BUGS
-Please report them to http://dhcpcd.berlios.de or http://bugs.gentoo.org.
+Please report them to http://dhcpcd.berlios.de
 .PD 0
 
 .SH AUTHORS
index 86ce2519df66540866fe1005c64676080a0267de..108047bca582563a2a22a1a6a9d202541b539cba 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -117,7 +117,7 @@ static pid_t read_pid (const char *pidfile)
 
 static void usage ()
 {
-       printf ("usage: "PACKAGE" [-adknpEGHMNRTY] [-c script] [-h hostame] [-i classID]\n"
+       printf ("usage: "PACKAGE" [-adknpEGHMNRTY] [-c script] [-h hostname] [-i classID]\n"
                "              [-l leasetime] [-m metric] [-r ipaddress] [-s ipaddress]\n"
                        "              [-t timeout] [-u userclass] [-F none | ptr | both]\n"
                        "              [-I clientID] <interface>\n");
@@ -476,15 +476,15 @@ int main(int argc, char **argv)
        chdir ("/");
        umask (022);
        
-       if (mkdir (CONFIGDIR, S_IRUSR |S_IWUSR |S_IXUSR | S_IRGRP | S_IXGRP
-                          | S_IROTH | S_IXOTH) && errno != EEXIST )
+       if (mkdir (INFODIR, S_IRUSR | S_IWUSR |S_IXUSR | S_IRGRP | S_IXGRP
+                          | S_IROTH | S_IXOTH) && errno != EEXIST)
        {
-               logger (LOG_ERR, "mkdir(\"%s\",0): %s\n", CONFIGDIR, strerror (errno));
+               logger (LOG_ERR, "mkdir(\"%s\",0): %s\n", INFODIR, strerror (errno));
                exit (EXIT_FAILURE);
        }
 
        if (mkdir (ETCDIR, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP
-                          | S_IROTH | S_IXOTH) && errno != EEXIST )
+                          | S_IROTH | S_IXOTH) && errno != EEXIST)
        {
                logger (LOG_ERR, "mkdir(\"%s\",0): %s\n", ETCDIR, strerror (errno));
                exit (EXIT_FAILURE);