From owner-freebsd-ports Fri Jun 23 0:10:19 2000 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 493CC37B55D for ; Fri, 23 Jun 2000 00:10:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id AAA72372; Fri, 23 Jun 2000 00:10:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Date: Fri, 23 Jun 2000 00:10:10 -0700 (PDT) Message-Id: <200006230710.AAA72372@freefall.freebsd.org> To: freebsd-ports@FreeBSD.org Cc: From: "Mario Sergio Fujikawa Ferreira" Subject: Re: ports/19449: The qmail port has /usr/local hardwired into it, and doesn't cerate /etc/mail/mailer.conf Reply-To: "Mario Sergio Fujikawa Ferreira" Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR ports/19449; it has been noted by GNATS. From: "Mario Sergio Fujikawa Ferreira" To: mwm@mired.org Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: ports/19449: The qmail port has /usr/local hardwired into it, and doesn't cerate /etc/mail/mailer.conf Date: Fri, 23 Jun 2000 03:54:45 -0300 > Apply the following patch to the qmail port Makefile. > > --- Makefile-wrong Thu Jun 22 13:44:44 2000 > +++ Makefile Thu Jun 22 13:44:33 2000 > @@ -132,13 +132,22 @@ > .for i in root postmaster mailer-daemon > @${TOUCH} ${PREFIX}/alias/.qmail-${i} > .endfor > + @# Replace /etc/mail/mailer.conf with one that uses qmail > + @$(ECHO) Replacing /etc/mail/mailer.conf with a qmail version. > + @$(ECHO) The old one is /etc/mail/mailer.conf-orig > + @-mv /etc/mail/mailer.conf /etc/mail/mailer.conf-orig > + @$(ECHO) "sendmail $(PREFIX)/bin/sendmail" > /etc/mail/mailer.conf > + @$(ECHO) "send-mail $(PREFIX)/bin/sendmail" >> /etc/mail/mailer.conf > + @$(ECHO) "mailq $(PREFIX)/bin/qmail-qread" >> /etc/mail/mailer.conf > + > @# 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 > + > > # hack to allow slave ports to include bsd.port.pre.mk and then this file > .if defined(_PREMKINCLUDED) > I am the maintainer. :) What do you think doing all of it as optional targets of the port? I wrote disable-sendmail/enable-sendmail and enable-qmail targets. They add/remove sendmail_enable="NO" from /etc/rc.conf and touch /etc/mail/mailer.conf besides giving directions on which rc to install. I'll end up writing an interactive script for choosing the rc file but not just now. Semester finals on the corner. I added your ${LOCALBASE} patch, I missed that one. :) Besides the aforementioned, I added some noted on what to undo when uninstalling the port to PLIST and updated pkg/MESSAGE. If you approve, I'll rest my case. If you don't, pvt me so that we can work out a solution. +Files added: files/mailer.conf.sample diff -urN qmail.orig/Makefile qmail/Makefile --- qmail.orig/Makefile Sun Jun 11 08:09:02 2000 +++ qmail/Makefile Fri Jun 23 03:36:41 2000 @@ -54,7 +54,8 @@ 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 @@ @# 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 @@ # 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 @@ > $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, diff -urN qmail.orig/files/PORT_NOTES_FreeBSD_40-RELEASE qmail/files/PORT_NOTES_FreeBSD_40-RELEASE --- qmail.orig/files/PORT_NOTES_FreeBSD_40-RELEASE Fri Feb 25 19:14:29 2000 +++ qmail/files/PORT_NOTES_FreeBSD_40-RELEASE Fri Jun 23 00:28:28 2000 @@ -45,8 +45,13 @@ 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". diff -urN qmail.orig/files/mailer.conf.sample qmail/files/mailer.conf.sample --- qmail.orig/files/mailer.conf.sample Wed Dec 31 21:00:00 1969 +++ qmail/files/mailer.conf.sample Fri Jun 23 00:28:47 2000 @@ -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 diff -urN qmail.orig/pkg/MESSAGE qmail/pkg/MESSAGE --- qmail.orig/pkg/MESSAGE Sat Jul 18 16:59:54 1998 +++ qmail/pkg/MESSAGE Fri Jun 23 03:38:48 2000 @@ -6,3 +6,11 @@ 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" diff -urN qmail.orig/pkg/PLIST qmail/pkg/PLIST --- qmail.orig/pkg/PLIST Tue May 30 01:18:52 2000 +++ qmail/pkg/PLIST Fri Jun 23 03:43:01 2000 @@ -155,4 +155,6 @@ @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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message