From: Roy Marples Date: Mon, 14 Apr 2008 13:09:44 +0000 (+0000) Subject: Change a few build/install knobs. X-Git-Tag: v4.0.2~493 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c46c624e7f2cfba9b12043c2f7d779f46ec3539b;p=thirdparty%2Fdhcpcd.git Change a few build/install knobs. --- diff --git a/Makefile b/Makefile index 4f0c669b..092ef7ce 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ VERSION= 3.3.0-alpha1 CLEANFILES= dhcpcd.8 BINDIR= ${PREFIX}/sbin -SCRIPTDIR= ${PREFIX}/etc +SYSCONFDIR?= ${PREFIX}/etc .SUFFIXES: .in @@ -21,8 +21,9 @@ MK= mk include ${MK}/prog.mk CFLAGS+= -DVERSION=\"${VERSION}\" -CFLAGS+= -DINFODIR=\"${INFODIR}\" +CFLAGS+= -DSYSCONFDIR=\"${SYSCONFDIR}\" +CFLAGS+= -DDBDIR=\"${DBDIR}\" LDADD+= ${LIBRT} .in: - ${SED} 's:@PREFIX@:${PREFIX}:g; s:@INFODIR@:${INFODIR}:g' $< > $@ + ${SED} 's:@SYSCONFDIR@:${SYSCONFDIR}:g; s:@DBDIR@:${DBDIR}:g' $< > $@ diff --git a/config.h b/config.h index f97bfd81..20354106 100644 --- a/config.h +++ b/config.h @@ -47,20 +47,24 @@ /* Packname name and pathname definitions. */ -#define PACKAGE "dhcpcd" +#define PACKAGE "dhcpcd" -#define ETCDIR "/etc" -#define RESOLVFILE ETCDIR "/resolv.conf" -#define DEFAULT_SCRIPT ETCDIR "/" PACKAGE ".sh" +#define RESOLVFILE "/etc/resolv.conf" +#ifndef SYSCONFDIR +# define SYSCONFDIR "/etc" +#endif +#define DEFAULTSCRIPT SYSCONFDIR "/" PACKAGE ".sh" -#define STATEDIR "/var" -#define PIDFILE STATEDIR "/run/" PACKAGE "-%s.pid" +#ifndef RUNDIR +# define RUNDIR "/var/run" +#endif +#define PIDFILE RUNDIR "/" PACKAGE "-%s.pid" -#ifndef INFODIR -# define INFODIR "/var/db" +#ifndef DBDIR +# define DBDIR "/var/db" #endif -#define LEASEFILE INFODIR "/" PACKAGE "-%s.lease" -#define INFOFILE INFODIR "/" PACKAGE "-%s.info" -#define DUIDFILE INFODIR "/" PACKAGE ".duid" +#define LEASEFILE DBDIR "/" PACKAGE "-%s.lease" +#define INFOFILE DBDIR "/" PACKAGE "-%s.info" +#define DUIDFILE DBDIR "/" PACKAGE ".duid" #endif diff --git a/dhcpcd.8.in b/dhcpcd.8.in index dd890ce5..90d4ed20 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -111,7 +111,7 @@ can use the option. .Ss Hooking into DHCP events .Nm -will run @PREFIX@/etc/dhcpcd.sh, or the script specified by the +will run @SYSCONFDIR@/dhcpcd.sh, or the script specified by the .Fl c , -script option. It will set $1 to a shell compatible file that holds various configuration settings obtained from the DHCP server and $2 to either @@ -172,7 +172,7 @@ different interfaces, the lower the metric the more it is preferred. Request the DHCP .Ar option variable for use in -.Pa @PREFIX@/etc/dhcpcd.sh . +.Pa @SYSCONFDIR@/dhcpcd.sh . .It Fl n , -renew Notifies an existing .Nm @@ -330,15 +330,15 @@ requires a Berkley Packet Filter, or BPF device on BSD based systems and a Linux Socket Filter, or LPF device on Linux based systems. .Sh FILES .Bl -ohang -.It Pa @PREFIX@/etc/dhcpcd.sh +.It Pa @SYSCONFDIR@/dhcpcd.sh Bourne shell script that is run when we configure or deconfigure an interface. -.It Pa @INFODIR@/dhcpcd.duid +.It Pa @DBDIR@/dhcpcd.duid Text file that holds the DUID used to identify the host. -.It Pa @INFODIR@/dhcpcd- Ns Ar interface Ns .info +.It Pa @DBDIR@/dhcpcd- Ns Ar interface Ns .info Bourne shell file that holds the DHCP values used in configuring the interface. This path is passed as the first argument to -.Pa @PREFIX@/etc/dhcpcd.sh . -.It Pa @INFODIR@/dhcpcd- Ns Ar interface Ns .lease +.Pa @SYSCONFDIR@/dhcpcd.sh . +.It Pa @DBDIR@/dhcpcd- Ns Ar interface Ns .lease The actual DHCP message send by the server. We use this when reading the last lease and use the files mtime as when it was issued. .El diff --git a/dhcpcd.c b/dhcpcd.c index 5d30a73b..feb2f6ca 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -169,7 +169,7 @@ main(int argc, char **argv) openlog(PACKAGE, LOG_PID, LOG_LOCAL0); options = xzalloc(sizeof(*options)); - options->script = (char *)DEFAULT_SCRIPT; + options->script = (char *)DEFAULTSCRIPT; snprintf(options->classid, CLASS_ID_MAX_LEN, "%s %s", PACKAGE, VERSION); diff --git a/mk/os-BSD.mk b/mk/os-BSD.mk index 682d747c..83064571 100644 --- a/mk/os-BSD.mk +++ b/mk/os-BSD.mk @@ -4,4 +4,4 @@ SRC_SOCKET= bpf.c SRC_IF= if-bsd.c -INFODIR= /var/db +DBDIR= /var/db diff --git a/mk/os-Linux.mk b/mk/os-Linux.mk index 0c9785d0..32c48081 100644 --- a/mk/os-Linux.mk +++ b/mk/os-Linux.mk @@ -6,7 +6,7 @@ SRC_IF= if-linux.c CFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600 LIBRT= -lrt -INFODIR= /var/lib/dhcpcd +DBDIR= /var/lib/dhcpcd # Work out if our fork() works or not _HAVE_FORK_SH= if test "${HAVE_FORK}" = "yes"; then \ diff --git a/mk/prog.mk b/mk/prog.mk index 61c1a8a2..fea7ca54 100644 --- a/mk/prog.mk +++ b/mk/prog.mk @@ -10,6 +10,8 @@ BINDIR?= ${PREFIX}/usr/bin BINMODE?= 0755 OBJS+= ${SRCS:.c=.o} +SYSCONFDIR?= ${PREFIX}/etc + INSTALL?= install SED?= sed @@ -32,8 +34,8 @@ _proginstall: ${PROG} ${INSTALL} -d ${DESTDIR}${INFODIR} _scriptinstall: ${SCRIPT} - ${INSTALL} -d ${DESTDIR}${SCRIPTDIR} - ${INSTALL} -m ${BINMODE} ${SCRIPT} ${DESTDIR}${SCRIPTDIR} + ${INSTALL} -d ${DESTDIR}${SYSCONFDIR} + ${INSTALL} -m ${BINMODE} ${SCRIPT} ${DESTDIR}${SYSCONFDIR} include ${MK}/depend.mk include ${MK}/man.mk