sendmail transition: Do not pre-generate sendmail.cf
authorJohn Marino <draco@marino.st>
Tue, 10 Mar 2015 10:46:07 +0000 (11:46 +0100)
committerJohn Marino <draco@marino.st>
Tue, 10 Mar 2015 11:54:37 +0000 (12:54 +0100)
Originally a starter sendmail.cf file was created using the .mc template
files and the m4 files installed from contrib/sendmail-8.14 directory.
This starter sendmail.cf was installed with "make distribution".  The
template files were only changed with "make upgrade" (not sure why but
maybe people tried editing them directly) and the Makefile was only
installed once.

This commit accomplishes these things:
  * No sendmail.cf or submit.cf file is created.  This was the last
    user of contrib/sendmail-8.14
  * etc/sendmail was altered to just install files
  * the README file the was recently placed in libexec/dma was relocated
    to etc/sendmail and updated
  * the /etc/mail/Makefile is now updated with installworld
  * the dragonfl*.mc templates are now updated with installworld

The suggested method to creating /etc/mail/sendmail.cf and
/etc/mail/submit.cf now on a new system is:
  1. cd /etc/mail
  2. type "make cf"
  3. <optional> edit new <hostname>.mc and <hostname>.submit.mc files
  4. <optional> type "make cf" again
  5. type "make install"

etc/Makefile
etc/sendmail/Makefile
etc/sendmail/Makefile.4install [moved from etc/mail/Makefile with 100% similarity]
etc/sendmail/README [moved from libexec/dma/mailer-conf/README with 82% similarity]
libexec/dma/mailer-conf/Makefile

index 9ab29f4..1424880 100644 (file)
@@ -60,8 +60,8 @@ MTREE=        BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
 
 PPPCNF=        ppp.conf
 
-ETCMAIL=Makefile mailer.conf access.sample virtusertable.sample \
-       mailertable.sample aliases
+ETCMAIL=aliases mailer.conf access.sample virtusertable.sample \
+       mailertable.sample
 
 # List of libraries in /usr/lib/compat that might have to be removed
 # from /usr/lib.
index 5e280d3..7631930 100644 (file)
@@ -1,92 +1,19 @@
-#      @(#)Makefile    8.19 (Berkeley) 1/14/97
-# $FreeBSD: src/etc/sendmail/Makefile,v 1.31 2004/01/22 17:51:02 ru Exp $
+# This installs the sendmail mc templates and the makefile used to
+# generate sendmail.cf and sendmail.submit.cf.  A README is also installed
 
-M4=            m4
-CHMOD=         chmod
-ROMODE=                444
-RM=            rm -f
+FILESDIR=      /etc/mail/
+FILESMODE=     644
 
-SENDMAIL_DIR=  ${.CURDIR}/../../contrib/sendmail-8.14
-SMDIR=         ${SENDMAIL_DIR}/sendmail
-SENDMAIL_CF_DIR?=${SENDMAIL_DIR}/cf
+FILES+=                Makefile \
+               README \
+               dragonfly.mc \
+               dragonfly.submit.mc
 
-# this is overkill, but....
-M4FILES!=      find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print
+CLEANFILES=    Makefile
 
-.SUFFIXES: .mc .cf
+Makefile: Makefile.4install
+       cp ${.ALLSRC} ${.TARGET}
 
-.mc.cf: ${M4FILES}
-       ${RM} ${.TARGET}
-       ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \
-           ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET}
-       ${CHMOD} ${ROMODE} ${.TARGET}
-
-DEST_CF=       ${DESTDIR}/etc/mail/sendmail.cf
-DEST_SUBMIT_CF=        ${DESTDIR}/etc/mail/submit.cf
-
-ALL=           dragonfly.cf dragonfly.submit.cf
-CLEANFILES=    dragonfly.cf dragonfly.submit.cf
-
-# Local SENDMAIL_MC may be set in /etc/make.conf.
-# Warning!  If set, this causes 'make install' to always copy it
-# over /etc/mail/sendmail.cf!!!
-# Caveat emptor!  Be sure you want this before you enable it.
-.if defined(SENDMAIL_MC)
-INSTALL_CF=    ${SENDMAIL_MC:T:R}.cf
-ALL+=          ${INSTALL_CF}
-CLEANFILES+=   ${SENDMAIL_MC:T:R}.cf
-${INSTALL_CF}: ${SENDMAIL_MC}
-.endif
-
-.if defined(SENDMAIL_SUBMIT_MC)
-INSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf
-ALL+=          ${INSTALL_SUBMIT_CF}
-CLEANFILES+=   ${INSTALL_SUBMIT_CF}
-${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
-.endif
-
-# Additional .cf files to build.
-.if defined(SENDMAIL_ADDITIONAL_MC)
-SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/}
-ALL+=          ${SENDMAIL_ADDITIONAL_CF}
-CLEANFILES+=   ${SENDMAIL_ADDITIONAL_CF}
-.for mc in ${SENDMAIL_ADDITIONAL_MC}
-${mc:T:R}.cf: ${mc}
-.endfor
-.endif
-
-all: ${ALL}
-
-distribution: dragonfly.cf dragonfly.submit.cf
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
-           ${.CURDIR}/dragonfly.mc dragonfly.cf ${DESTDIR}/etc/mail
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
-           ${.CURDIR}/dragonfly.submit.mc dragonfly.submit.cf ${DESTDIR}/etc/mail
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 \
-           /dev/null ${DESTDIR}/var/log/sendmail.st
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
-           dragonfly.cf ${DEST_CF}
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
-           dragonfly.submit.cf ${DEST_SUBMIT_CF}
-
-upgrade:
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
-           ${.CURDIR}/dragonfly.mc ${DESTDIR}/etc/mail
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
-           ${.CURDIR}/dragonfly.submit.mc ${DESTDIR}/etc/mail
-
-install:
-.if defined(INSTALL_CF) && ${INSTALL_CF} != ${DEST_CF}
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
-           ${INSTALL_CF} ${DEST_CF}
-.endif
-.if defined(SENDMAIL_ADDITIONAL_CF)
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
-           ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
-.endif
-.if defined(INSTALL_SUBMIT_CF) && ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
-       ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
-           ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
-.endif
+beforedepend:  Makefile
 
 .include <bsd.prog.mk>
similarity index 82%
rename from libexec/dma/mailer-conf/README
rename to etc/sendmail/README
index 237bdb2..54b09b3 100644 (file)
@@ -19,11 +19,14 @@ if both sendmail_enable and sendmail_submit_enable are set to "NO", you
 must do the following for command line submitted mail:
 
    Designate an alternative host for the submission agent to contact
-   by altering /etc/mail/dragonfly.submit.mc (or setting SENDMAIL_SUBMIT_MC
-   in /etc/make.conf to an alternate .mc file) and using
-   'make install-submit-cf' in /etc/mail/.  Change the FEATURE(msp) line
-   to FEATURE(msp, hostname) where hostname is the fully qualified hostname
-   of the alternative host.
+   by creating /etc/mail/<hostname>.submit.mc or using an alternate .mc
+   file and setting SENDMAIL_SUBMIT_MC in /etc/make.conf.  Do not edit
+   dragonfly.submit.mc directly as it will be overwritten eventually, but
+   it certainly can be copied to be used as a template.
+
+   Type 'make install-submit-cf' in /etc/mail/ to generate the submit.cf
+   file.  Change the FEATURE(msp) line to FEATURE(msp, hostname) where
+   hostname is the fully qualified hostname of the alternative host.
 
 Also, as of 8.12, a new queue-running daemon is started to make sure mail
 doesn't remain in the client mail queue.  By default, it simply runs the
index a5c20cb..1e87feb 100644 (file)
@@ -4,8 +4,7 @@
 FILESDIR=      /etc/mail/
 FILESMODE=     644
 
-FILES+=                README \
-               mailer.conf.dma \
+FILES+=                mailer.conf.dma \
                mailer.conf.opensmtpd \
                mailer.conf.postfix \
                mailer.conf.sendmail