]> git.ipfire.org Git - people/ms/dma.git/commitdiff
access config files at CONF_PATH, add makefile target to install conf files
authorSimon Schubert <2@0x2c.org>
Wed, 16 Nov 2011 11:55:30 +0000 (12:55 +0100)
committerSimon Schubert <2@0x2c.org>
Wed, 16 Nov 2011 11:55:30 +0000 (12:55 +0100)
Makefile
README.markdown
debian/rules
dma.c
dma.h

index a480e9340bfa3280ed49c8df8c2b11eef2378eef..cc744a76c9497497e75a310efb098f4c16589b94 100644 (file)
--- 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
 
index ef6a795d7d9dda6b4712f4cd63a1f4c129eb9c03..528a4d65c862c978cbd06046974a92dfc2a95242 100644 (file)
@@ -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
index 6b1416e07de7e5fd74977d48fa487f0abbb41b31..461a0a8503f629f70c8dbcbe0e24dfdb623ed5b1 100755 (executable)
@@ -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 205e2bf90c4a2661c73069f25487576519861f93..3b1aeb1eac88f7ee2edcf919d98caff6c0cefb84 100644 (file)
--- 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 029f41c57b8b9101e23fb1a83e49e8b6c4a76146..69c981b86a624de68adefb4eba1094fff1035cd8 100644 (file)
--- 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