Provide a new make.conf knob, SENDMAIL_SUBMIT_MC to allow users to pick

the .mc file used for /etc/mail/submit.cf.  By default,
/etc/mail/freebsd.submit.mc is installed and used.

Requested by:	fenner
Submitted by:	ume
MFC after:	1 week
This commit is contained in:
Gregory Neil Shapiro 2002-04-14 19:20:26 +00:00
parent 81a587f467
commit 14d6d7657a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=94676
4 changed files with 87 additions and 18 deletions

View File

@ -41,14 +41,19 @@
# running sendmail to pick up the changes as well. # running sendmail to pick up the changes as well.
# #
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# # This Makefile uses `<HOSTNAME>.mc' as the default MTA .mc file. This
# This makefile uses `<HOSTNAME>.mc' as the default .mc file. This can # can be changed by defining SENDMAIL_MC in /etc/make.conf, e.g.:
# be changed by defining SENDMAIL_MC in /etc/make.conf, e.g.:
# #
# SENDMAIL_MC=/etc/mail/myconfig.mc # SENDMAIL_MC=/etc/mail/myconfig.mc
# #
# If '<HOSTNAME>.mc' does not exist, it is created using 'freebsd.mc' # If '<HOSTNAME>.mc' does not exist, it is created using 'freebsd.mc'
# as a template. # as a template.
#
# It also uses 'freebsd.submit.mc' as the default mail submission .mc file.
# This can be changed by defining SENDMAIL_SUBMIT_MC in /etc/make.conf,
# e.g.:
#
# SENDMAIL_SUBMIT_MC=/etc/mail/mysubmit.mc
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
# #
# The Makefile knows about the following maps: # The Makefile knows about the following maps:
@ -64,8 +69,14 @@ ${SENDMAIL_MC}:
cp freebsd.mc ${SENDMAIL_MC} cp freebsd.mc ${SENDMAIL_MC}
.endif .endif
SENDMAIL_SUBMIT_MC?= freebsd.submit.mc
INSTALL_CF= ${SENDMAIL_MC:R}.cf INSTALL_CF= ${SENDMAIL_MC:R}.cf
.ifndef SENDMAIL_SET_USER_ID
INSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:R}.cf
.endif
SENDMAIL_ALIASES?= /etc/mail/aliases SENDMAIL_ALIASES?= /etc/mail/aliases
# #
@ -160,24 +171,35 @@ clean:
depend: depend:
cf: ${INSTALL_CF} cf: ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
submit.cf: submit.mc .ifdef SENDMAIL_SET_USER_ID
install: install-cf
.else
install: install-cf install-submit-cf
.endif
install-cf: ${INSTALL_CF}
.if ${INSTALL_CF} != /etc/mail/sendmail.cf
${INSTALL} -c -m ${SHAREMODE} ${INSTALL_CF} /etc/mail/sendmail.cf
.endif
install-submit-cf: ${INSTALL_SUBMIT_CF}
.ifdef SENDMAIL_SET_USER_ID .ifdef SENDMAIL_SET_USER_ID
@echo ">>> ERROR: You should not create a submit.cf file if you are using a" @echo ">>> ERROR: You should not create a submit.cf file if you are using a"
@echo " set-user-ID sendmail binary (SENDMAIL_SET_USER_ID is set" @echo " set-user-ID sendmail binary (SENDMAIL_SET_USER_ID is set"
@echo " in make.conf)." @echo " in make.conf)."
@false @false
.else
.if ${INSTALL_SUBMIT_CF} != /etc/mail/submit.cf
${INSTALL} -c -m ${SHAREMODE} ${INSTALL_SUBMIT_CF} /etc/mail/submit.cf
.endif
.endif .endif
maps: ${SENDMAIL_MAP_OBJ}
aliases: ${SENDMAIL_ALIASES}.db aliases: ${SENDMAIL_ALIASES}.db
install: ${INSTALL_CF} maps: ${SENDMAIL_MAP_OBJ}
.if ${INSTALL_CF} != /etc/mail/sendmail.cf
${INSTALL} -c -m ${SHAREMODE} ${INSTALL_CF} /etc/mail/sendmail.cf
.endif
start start-mta start-mspq: start start-mta start-mspq:
@if [ -r ${SENDMAIL_START_SCRIPT} ]; then \ @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \

View File

@ -37,9 +37,16 @@ INSTALL_CF= ${SENDMAIL_CF}
.endif .endif
.endif .endif
DEST_CF= ${DESTDIR}/etc/mail/sendmail.cf .ifndef SENDMAIL_SET_USER_ID
.if defined(SENDMAIL_SUBMIT_MC)
INSTALL_SUBMIT_CF=${SENDMAIL_SUBMIT_MC:R}.cf
.endif
.endif
ALL+= ${INSTALL_CF} DEST_CF= ${DESTDIR}/etc/mail/sendmail.cf
DEST_SUBMIT_CF= ${DESTDIR}/etc/mail/submit.cf
ALL+= ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
# Make sure we don't remove /etc/mail/sendmail.cf on make clean # Make sure we don't remove /etc/mail/sendmail.cf on make clean
# since this will break a running system during a buildworld. # since this will break a running system during a buildworld.
@ -49,6 +56,12 @@ CLEANFILES+= ${INSTALL_CF}
.endif .endif
.endif .endif
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
CLEANFILES+= ${INSTALL_SUBMIT_CF}
.endif
.endif
# Additional .cf files to build # Additional .cf files to build
.if defined(SENDMAIL_ADDITIONAL_MC) .if defined(SENDMAIL_ADDITIONAL_MC)
SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g} SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
@ -60,7 +73,7 @@ all: ${ALL}
depend: depend:
install: ${INSTALL_CF} install: ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF)) .if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set" @echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
@false @false
@ -70,14 +83,22 @@ install: ${INSTALL_CF}
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \ ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
${DEST_CF} ${DEST_CF}
.endif .endif
.endif
.if defined(SENDMAIL_ADDITIONAL_CF) .if defined(SENDMAIL_ADDITIONAL_CF)
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \ ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \
${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
.endif .endif
.ifndef SENDMAIL_SET_USER_ID
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \
${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
.endif
.endif
.endif .endif
# Helper for src/etc/Makefile # Helper for src/etc/Makefile
distribution: freebsd.cf freebsd.mc ${INSTALL_CF} distribution: freebsd.cf freebsd.mc ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF)) .if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set" @echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
@false @false
@ -97,11 +118,20 @@ distribution: freebsd.cf freebsd.mc ${INSTALL_CF}
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \ ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
${DEST_CF} ${DEST_CF}
.endif .endif
.ifndef SENDMAIL_SET_USER_ID
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \
${DESTDIR}/etc/mail/submit.mc ${DESTDIR}/etc/mail/freebsd.submit.mc
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
${DESTDIR}/etc/mail/submit.cf ${DESTDIR}/etc/mail/freebsd.submit.cf
.ifndef SENDMAIL_SET_USER_ID
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \
${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
.endif
.else
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
${DEST_SUBMIT_CF}
.endif
.endif .endif
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
${DESTDIR}/etc/mail/helpfile ${DESTDIR}/etc/mail/helpfile

View File

@ -258,6 +258,13 @@
# #
#SENDMAIL_MC=/etc/mail/myconfig.mc #SENDMAIL_MC=/etc/mail/myconfig.mc
# #
# The following sets the default m4 configuration file for mail
# submission to use at install time. Use with caution as a make
# install will overwrite any existing /etc/mail/submit.cf. The
# value should be a fully qualified path name.
#
#SENDMAIL_SUBMIT_MC=/etc/mail/mysubmit.mc
#
# If you need to build additional .cf files during a make buildworld, # If you need to build additional .cf files during a make buildworld,
# include the full paths to the .mc files in SENDMAIL_ADDITIONAL_MC. # include the full paths to the .mc files in SENDMAIL_ADDITIONAL_MC.
# #

View File

@ -520,6 +520,16 @@ Use with caution as a make install will overwrite any existing
Note that Note that
.Va SENDMAIL_CF .Va SENDMAIL_CF
is now deprecated. is now deprecated.
.It Va SENDMAIL_SUBMIT_MC
.Pq Vt str
The default m4 configuration file for mail submission
to use at install time.
The value should include the full path to the
.Pa .mc
file, e.g.,
.Pa /etc/mail/mysubmit.mc .
Use with caution as a make install will overwrite any existing
.Pa /etc/mail/submit.cf .
.It Va SENDMAIL_ADDITIONAL_MC .It Va SENDMAIL_ADDITIONAL_MC
.Pq Vt str .Pq Vt str
Additional Additional