From mwm@mired.org  Thu Jun 22 16:48:24 2000
Return-Path: <mwm@mired.org>
Received: from guru.mired.org (zoom2-182.telepath.com [216.14.2.182])
	by hub.freebsd.org (Postfix) with SMTP id 7A57C37B684
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 22 Jun 2000 16:48:02 -0700 (PDT)
	(envelope-from mwm@mired.org)
Received: (qmail 94829 invoked by uid 100); 22 Jun 2000 23:47:44 -0000
Message-Id: <20000622234744.94828.qmail@guru.mired.org>
Date: 22 Jun 2000 23:47:44 -0000
From: mwm@mired.org
Reply-To: mwm@mired.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: The qmail port has /usr/local hardwired into it, and doesn't cerate /etc/mail/mailer.conf
X-Send-Pr-Version: 3.2

>Number:         19449
>Category:       ports
>Synopsis:       The qmail port has /usr/local hardwired into it, and doesn't cerate /etc/mail/mailer.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    steve
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 22 16:50:01 PDT 2000
>Closed-Date:    Fri Jul 7 11:49:49 PDT 2000
>Last-Modified:  Fri Jul 07 11:52:44 PDT 2000
>Originator:     Mike Meyer
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Meyer Consulting
>Environment:

	LOCALBASE is set to something other that /usr/local when
	installing the qmail port.

>Description:

	The qmail port creates a symlink in /usr/local/etc/rc.d/ to
	start qmail, even if LOCALBASE is set to something else.
	
	Since mailwrapper has been added, the qmail port ought to take
	advantage of it. This patch includes changs to the Makefile to
	move the old mailwrapper.coonf out of the way, and create one
	for use with qmail.


>How-To-Repeat:

	"make install" in /usr/ports/mail/qmail with LOCALBASE set to
	anything but /usr/local. Notice that
	/usr/local/etc/rc.d/qmail.sh now exists, pointing to
	/var/qmail/rc. Also notice that /etc/mail/mailer.conf still references
	the standard sendmail install.

>Fix:

	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)



>Release-Note:
>Audit-Trail:

From: Ben Smithurst <ben@scientia.demon.co.uk>
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 02:25:37 +0100

 --H7BIH7T1fRJ3RGOi
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 mwm@mired.org wrote:
 
 > +	@# Replace /etc/mail/mailer.conf with one that uses qmail
 > +	@$(ECHO) Replacing /etc/mail/mailer.conf with a qmail version.=20
 > +	@$(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
 
 No.  Please.  Do this under a 'make replace' target like postfix does,
 I don't think ports should be touching /etc without good reason (this
 isn't one).  Print a message out as part of 'make install' telling the
 user what to do, again like postfix does.
 
 --=20
 Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D
 
 --H7BIH7T1fRJ3RGOi
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: PGPfreeware 5.0i for non-commercial use
 MessageID: cO3A+Ha5fFuSJXloJkzkY6CuALM/qcCn
 
 iQCVAwUBOVK8kCsPVtiZOS99AQHb+QP9Hn/tKlSS2Bfgrcj/pCDVqVG72U4+QxK5
 VBluYqSBxWV5XhOs21B8CUCY+VpZuar7LiX3DpR8aJoAlBHRhA9XzR6oZElsVUCx
 1MaNS6u8zXY547lCrs+xWA1In7HxRqswmNhbdvA+grggzp11V0v89k/YcB0QRv8N
 1wlJG7voP3s=
 =RxFO
 -----END PGP SIGNATURE-----
 
 --H7BIH7T1fRJ3RGOi--
 

From: Mike Meyer <mwm@mired.org>
To: Ben Smithurst <ben@scientia.demon.co.uk>
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-ports@freebsd.org
Subject: Re: ports/19449: The qmail port has /usr/local hardwired into it, and doesn't cerate /etc/mail/mailer.conf
Date: Thu, 22 Jun 2000 22:06:26 -0500 (CDT)

 Ben Smithurst writes:
 > mwm@mired.org wrote:
 > > +	@# 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
 > No.  Please.  Do this under a 'make replace' target like postfix does,
 > I don't think ports should be touching /etc without good reason (this
 > isn't one).  Print a message out as part of 'make install' telling the
 > user what to do, again like postfix does.
 
 That sounds like an improvement to me. However, I will leave that to
 someone who can commit the change (unless asked, but I'm going to be
 unavailable for work for a couple of weeks).
 
 	<mike
 

From: "Mario Sergio Fujikawa Ferreira" <lioux@uol.com.br>
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 dont 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
 
Responsible-Changed-From-To: freebsd-ports->steve 
Responsible-Changed-By: steve 
Responsible-Changed-When: Thu Jul 6 19:01:50 PDT 2000 
Responsible-Changed-Why:  
I have this one ready to commit. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19449 
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Fri Jul 7 11:49:49 PDT 2000 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19449 
>Unformatted:
