- Don't hardcode /usr/local.

- Also add a mailer.conf that allows sendmail to be replaced with qmail.

PR:		19449
Submitted by:	Mike Meyer <mwm@mired.org> and maintainer
This commit is contained in:
Steve Price 2000-07-07 18:52:32 +00:00
parent 29a402115e
commit c0a42fd5da
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=30321
5 changed files with 120 additions and 7 deletions

View File

@ -54,7 +54,8 @@ PLIST_SUB= DOCDIR=${DOCDIR}
DOCFILES+= ${WRKSRC}/BLURB ${WRKSRC}/BLURB2 ${WRKSRC}/BLURB3 \
${WRKSRC}/BLURB4 ${WRKSRC}/INTERNALS ${WRKSRC}/SECURITY \
${WRKSRC}/THOUGHTS ${FILESDIR}/PORT_NOTES \
${FILESDIR}/PORT_NOTES_FreeBSD_40-RELEASE
${FILESDIR}/PORT_NOTES_FreeBSD_40-RELEASE \
${WRKDIR}/mailer.conf.sample
# The following docfiles are normally installed with qmail-hier
DOCFILES+= ${WRKSRC}/FAQ ${WRKSRC}/UPGRADE ${WRKSRC}/SENDMAIL \
@ -135,10 +136,10 @@ do-install:
@# This is not part of qmail proper, hence the 2nd class citizenship
${INSTALL_SCRIPT} ${FILESDIR}/mkaliasdir ${PREFIX}/${DOCDIR}
@cd ${PREFIX}/configure ; ./config
@${MKDIR} /usr/local/etc/rc.d
@${LN} -sf ${PREFIX}/rc /usr/local/etc/rc.d/qmail.sh
@${MKDIR} ${LOCALBASE}/etc/rc.d
@${LN} -sf ${PREFIX}/rc ${LOCALBASE}/etc/rc.d/qmail.sh
@${ECHO}
@${SED} s!/var/qmail!${PREFIX}/!g ${PKGDIR}/MESSAGE | /usr/bin/fmt
@${SED} s!/var/qmail!${PREFIX}!g ${PKGDIR}/MESSAGE | /usr/bin/fmt
# hack to allow slave ports to include bsd.port.pre.mk and then this file
.if defined(_PREMKINCLUDED)
@ -150,7 +151,7 @@ do-install:
# Ugh... ;-)
thereal-post-patch:
.for i in ${BOOTFILES}
if [ `dirname $i` != ${FILESDIR} ] ; \
@if [ `dirname $i` != ${FILESDIR} ] ; \
then \
${CP} $i.sh $i.sh.orig; \
(head -c `${EXPR} \`ls -l $i.sh.orig \
@ -158,6 +159,94 @@ thereal-post-patch:
> $i.sh ; \
fi
.endfor
@${SED} s!/var/qmail/!${PREFIX}/!g ${FILESDIR}/mailer.conf.sample > \
${WRKDIR}/mailer.conf.sample
# Double Ugh... ;-)
${WRKDIR}/.thereal_disable_sendmail_done:
@if [ ! -d ${WRKDIR} ]; \
then \
${MKDIR} ${WRKDIR} ; \
fi
# I would like some input on the targets below. Only constructive ones
# please. :)
# based on shells/pdksh /etc/shells update PLIST.
thereal-disable-sendmail: ${WRKDIR}/.thereal_disable_sendmail_done /etc/rc.conf
@if [ -f /etc/rc.conf ]; \
then \
${CP} /etc/rc.conf /etc/rc.conf.bak && \
${GREP} -v sendmail_enable /etc/rc.conf.bak > \
/etc/rc.conf && \
${TOUCH} ${WRKDIR}/.thereal_disable_sendmail_done ; \
else \
${ECHO_MSG} ¨===> ERROR: YOU DO NOT HAVE A VALID /etc/rc.conf¨ ; \
${ECHO_MSG} ¨===> FIX this and try again¨ ; \
${FALSE} ; \
fi
disable-sendmail: thereal-disable-sendmail
@${ECHO_MSG} "===> I hope you know what you are doing:"
@${ECHO_MSG} "===> You just told your system to not"
@${ECHO_MSG} "===> automaticaly start sendmail on your"
@${ECHO_MSG} "===> next startup."
@${ECHO_MSG} "===> (i.e., added sendmail_enable=\¨NO\¨ to rc.conf)"
@if [ -f /etc/rc.conf ]; \
then \
${ECHO} sendmail_enable=\"NO\" >> /etc/rc.conf ; \
fi
enable-sendmail: thereal-disable-sendmail
@${ECHO_MSG} "===> I hope you know what you are doing:"
@${ECHO_MSG} "===> You just told your system to"
@${ECHO_MSG} "===> automaticaly start sendmail on your"
@${ECHO_MSG} "===> next startup."
@${ECHO_MSG} "===> (i.e., removed sendmail_enable=\¨NO\¨ from rc.conf)"
enable-qmail: install disable-sendmail
@if [ -f /etc/mail/mailer.conf ]; \
then \
${CP} /etc/mail/mailer.conf /etc/mail/mailer.conf.bak && \
${CP} ${WRKDIR}/mailer.conf.sample /etc/mail/mailer.conf ; \
else \
${ECHO_MSG} "===> ERROR: YOU DO NOT HAVE A VALID /etc/mail/mailer.conf" ; \
${ECHO_MSG} "===> FIX this and try again" ; \
${ECHO_MSG} "===> or, do \¨make force_enable_qmail\¨ if you are sure" ; \
${ECHO_MSG} "===> you want this port replacing some binaries" ; \
${ECHO_MSG} "===> IF THIS FEELS UNEASY, read ${PREFIX}/${DOCDIR}/REMOVE.sendmail and do it manually" ; \
fi
@${ECHO} "===> Do not forget to choose an appropriate qmail startup"
@${ECHO} "===> script. Go through ${PREFIX}/boot, choose one"
@${ECHO} "===> and copy the chosen script as ${PREFIX}/rc"
@${ECHO} "===> For example, \¨cp ${PREFIX}/boot/proc+df ${PREFIX}/rc\¨"
# taken from mail/postfix idea
force-enable-qmail: install disable-sendmail
@${ECHO_MSG} "===> Replacing sendmail"
@if [ -e /usr/sbin/sendmail ]; then \
${MV} -f /usr/sbin/sendmail /usr/sbin/sendmail.OFF && \
${CHMOD} 0 /usr/sbin/sendmail.OFF; \
fi
@if [ -e ${PREFIX}/bin/sendmail ]; then \
${LN} -s ${PREFIX}/bin/sendmail /usr/sbin/sendmail; \
fi
@${ECHO_MSG} "===> Replacing mailq"
@if [ -e /usr/bin/mailq ]; then \
${MV} -f /usr/bin/mailq /usr/bin/mailq.OFF && \
${CHMOD} 0 /usr/bin/mailq.OFF; \
fi
@if [ -e ${PREFIX}/bin/qmail-qread ]; then \
${LN} -s ${PREFIX}/bin/qmail-qread /usr/bin/mailq; \
fi
@${ECHO_MSG} "===> Replacing newaliases"
@if [ -e /usr/bin/newaliases ]; then \
${MV} -f /usr/bin/newaliases /usr/bin/newaliases.OFF && \
${CHMOD} 0 /usr/bin/newaliases.OFF; \
fi
@if [ -e ${PREFIX}/bin/newaliases ]; then \
${LN} -s ${PREFIX}/bin/newaliases /usr/bin/newaliases; \
fi
# The users are instructed (in PORT_NOTES) to install ${QUEUE_DIR}/rc
# themselves. Each /var/qmail/ should have its own rc. On many machines,

View File

@ -45,9 +45,14 @@ Here follows my personal /etc/mail/mailer.conf
sendmail /var/qmail/bin/sendmail
send-mail /var/qmail/bin/sendmail
mailq /var/qmail/bin/qmail-qstat
mailq /var/qmail/bin/qmail-qread
newaliases /var/qmail/bin/newaliases
There is a sample mailer.conf in this directory, please install
over the /etc/mail/mailer.conf to unfold qmail as your default MTA.
Please don´t forget to backup /etc/mail/mailer.conf before doing
so. Better safe then sorry.
So, whenever you call sendmail, in fact, you are using the appropriate
"qmail-clones".

View File

@ -0,0 +1,8 @@
# Configuration for mailwrapper is kept in /etc/mail/mailer.conf.
# Replace that file with this one to enable qmail under a sendmail
# disguise. Very useful.
sendmail /var/qmail/bin/sendmail
send-mail /var/qmail/bin/sendmail
mailq /var/qmail/bin/qmail-qread
newaliases /var/qmail/bin/newaliases

View File

@ -6,3 +6,11 @@ qmail, and finally replacing sendmail with qmail.
You should also add /var/qmail/man to your MANPATH (see manpath(1)
or login.conf(5)).
You can enable qmail as your default mailer:
# this will disable the default MTA
1) do "make disable-sendmail"
# enable qmail as your default MTA
2) do "make enable-qmail"

View File

@ -148,6 +148,7 @@ configure/dnsptr
%%DOCDIR%%/PORT_NOTES
%%DOCDIR%%/PORT_NOTES_FreeBSD_40-RELEASE
%%DOCDIR%%/SYSDEPS
%%DOCDIR%%/mailer.conf.sample
%%DOCDIR%%/mkaliasdir
boot/maildir
@dirrm %%DOCDIR%%
@ -155,4 +156,6 @@ boot/maildir
@dirrm boot
@dirrm bin
@unexec echo "If you are permanently removing qmail, you should also ``rm -Rf ${PKG_PREFIX}/alias ${PKG_PREFIX}/control ${PKG_PREFIX}/queue ${PKG_PREFIX}/users'' and remove the qmail users/groups." | /usr/bin/fmt
@unexec echo "1) If you are permanently removing qmail, you should also ``rm -Rf ${PKG_PREFIX}/alias ${PKG_PREFIX}/control ${PKG_PREFIX}/queue ${PKG_PREFIX}/users'' and remove the qmail users/groups." | /usr/bin/fmt
@unexec echo "2) Do not forget to reconfigure your /etc/mail/mailer.conf to use your older MTA, or reconfigure your old MTA binaries if you decided to replace them." | /usr/bin/fmt
@unexec echo "3) Do not forget to enable sendmail as your default MTA if you have to. Go to mail/qmail portsdir and do a 'make enable-sendmail'" | /usr/bin/fmt