From d84c3daabcae8474ff648b0d24bdbc146dc5ebd3 Mon Sep 17 00:00:00 2001 From: Simon Schubert <2@0x2c.org> Date: Wed, 16 Nov 2011 12:55:30 +0100 Subject: [PATCH] access config files at CONF_PATH, add makefile target to install conf files --- Makefile | 21 ++++++++++++++++++--- README.markdown | 2 +- debian/rules | 6 ++---- dma.c | 2 +- dma.h | 2 +- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index a480e93..cc744a7 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ CC?= gcc CFLAGS?= -O -pipe LDADD?= -lssl -lcrypto -lresolv -CFLAGS+= -Wall -DDMA_VERSION='"${version}"' -DLIBEXEC_PATH='"${LIBEXEC}"' +CFLAGS+= -Wall -DDMA_VERSION='"${version}"' -DLIBEXEC_PATH='"${LIBEXEC}"' -DCONF_PATH='"${CONFDIR}"' INSTALL?= install -p CHGRP?= chgrp @@ -24,7 +24,7 @@ CHMOD?= chmod PREFIX?= /usr/local SBIN?= ${PREFIX}/sbin LIBEXEC?= ${PREFIX}/lib -CONFDIR?= /etc +CONFDIR?= /etc/dma MAN?= ${PREFIX}/share/man VAR?= /var DMASPOOL?= ${VAR}/spool/dma @@ -46,7 +46,7 @@ clean: -rm -f aliases_parse.[ch] aliases_scan.c install: all - ${INSTALL} -d ${DESTDIR}${SBIN} ${DESTDIR}${CONFDIR} + ${INSTALL} -d ${DESTDIR}${SBIN} ${INSTALL} -d ${DESTDIR}${MAN}/man8 ${DESTDIR}${LIBEXEC} ${INSTALL} -m 2755 -o root -g mail dma ${DESTDIR}${SBIN} ${INSTALL} -m 4754 -o root -g mail dma-mbox-create ${DESTDIR}${LIBEXEC} @@ -66,6 +66,21 @@ permissions: -${CHGRP} mail ${DESTDIR}${VARMAIL}/* -${CHMOD} g+w ${DESTDIR}${VARMAIL}/* +install-etc: + ${INSTALL} -d ${DESTDIR}${CONFDIR} + @if [ -e ${DESTDIR}${CONFDIR}/dma.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/dma.conf."; \ + else \ + echo ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 644 -o root -g mail dma.conf ${DESTDIR}${CONFDIR}; \ + fi + @if [ -e ${DESTDIR}${CONFDIR}/auth.conf ]; then \ + echo "Not overwriting ${DESTDIR}${CONFDIR}/auth.conf."; \ + else \ + echo ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + ${INSTALL} -m 640 -o root -g mail auth.conf ${DESTDIR}${CONFDIR}; \ + fi + aliases_parse.c: aliases_parse.y ${YACC} -d -o aliases_parse.c aliases_parse.y diff --git a/README.markdown b/README.markdown index ef6a795..528a4d6 100644 --- a/README.markdown +++ b/README.markdown @@ -21,7 +21,7 @@ Building Installation ------------ - make install sendmail-link mailq-link install-spool-dirs + make install sendmail-link mailq-link install-spool-dirs install-etc Contact diff --git a/debian/rules b/debian/rules index 6b1416e..461a0a8 100755 --- a/debian/rules +++ b/debian/rules @@ -5,7 +5,7 @@ DDIR= $(CURDIR)/debian D= $(DDIR)/dma -BUILDDEFS= DESTDIR=$D PREFIX=/usr CONFDIR=/etc +BUILDDEFS= DESTDIR=$D PREFIX=/usr CFLAGS:= $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS:= $(shell dpkg-buildflags --get CPPFLAGS) @@ -36,9 +36,7 @@ override_dh_auto_clean: $(MAKE) -C $(DDIR)/migrate clean override_dh_auto_install: - $(MAKE) -f Makefile ${BUILDDEFS} install sendmail-link mailq-link install-spool-dirs - install -o root -g mail -m 644 dma.conf $D/etc/dma - install -o root -g mail -m 640 auth.conf $D/etc/dma + $(MAKE) -f Makefile ${BUILDDEFS} install sendmail-link mailq-link install-spool-dirs install-etc override_dh_fixperms: dh_fixperms -Xusr/sbin/dma -Xusr/lib/dma-mbox-create -Xvar/spool/dma -Xetc/dma diff --git a/dma.c b/dma.c index 205e2bf..3b1aeb1 100644 --- a/dma.c +++ b/dma.c @@ -513,7 +513,7 @@ skipopts: if (sigaction(SIGHUP, &act, NULL) != 0) syslog(LOG_WARNING, "can not set signal handler: %m"); - parse_conf(CONF_PATH); + parse_conf(CONF_PATH "/dma.conf"); if (config.authpath != NULL) parse_authfile(config.authpath); diff --git a/dma.h b/dma.h index 029f41c..69c981b 100644 --- a/dma.h +++ b/dma.h @@ -67,7 +67,7 @@ #define TLS_OPP 0x080 /* Opportunistic STARTTLS */ #ifndef CONF_PATH -#define CONF_PATH "/etc/dma/dma.conf" /* Default path to dma.conf */ +#error Please define CONF_PATH #endif #ifndef LIBEXEC_PATH -- 2.39.2