Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jan 2016 10:31:51 +0000 (UTC)
From:      Olli Hauer <ohauer@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r405233 - in head/mail/postfix-current: . files
Message-ID:  <201601041031.u04AVpAj043530@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ohauer
Date: Mon Jan  4 10:31:51 2016
New Revision: 405233
URL: https://svnweb.freebsd.org/changeset/ports/405233

Log:
  - rework pkg-install and pkg-message [1]
  
  - install postfix specific mailer.conf.postfix into DATADIR [2]
  
  - make EAI the default, postfix will reject messages if build
    w.o. EAI and compatibility_level is set to a value >=1 [3]
  
  - use new notation instead PATCH_DIST_STRIP
  
  - bump PORTREVISION
  
  1) detect if the port is installed without TERM, in this case
     do not ask the to make postfix the default mailer and respect
     the env POSTFIX_DEFAULT_MTA. This helps tools like salt,
     ansible, cfengine and puppet during the first package installation.
  
  2) $DATADIR/mailer.conf.postfix can be used by the tools in 1)
  
  3) Issue noted by Melissa Pilgrim by PM
     Short description of the issue:
      If compatibility_level is set to a value >= 1, then postfix set
      smtputf8_enable=yes.  For more information see
       $ postconf -d | grep compatibility_level
      and
       http://www.postfix.org/SMTPUTF8_README.html
  
  MFH:		2016Q1

Added:
  head/mail/postfix-current/files/mailer.conf.postfix.in   (contents, props changed)
Modified:
  head/mail/postfix-current/Makefile
  head/mail/postfix-current/files/pkg-install.in
  head/mail/postfix-current/files/pkg-message.in
  head/mail/postfix-current/pkg-plist

Modified: head/mail/postfix-current/Makefile
==============================================================================
--- head/mail/postfix-current/Makefile	Mon Jan  4 10:23:33 2016	(r405232)
+++ head/mail/postfix-current/Makefile	Mon Jan  4 10:31:51 2016	(r405233)
@@ -3,6 +3,7 @@
 
 PORTNAME=	postfix
 DISTVERSION=	3.0-20151003
+PORTREVISION=	1
 PORTEPOCH=	4
 CATEGORIES=	mail ipv6
 MASTER_SITES=	ftp://ftp.porcupine.org/mirrors/postfix-release/ \
@@ -47,7 +48,7 @@ OPTIONS_DEFINE=	BDB CDB DOCS EAI INST_BA
 OPTIONS_RADIO=		RG1 RG2
 OPTIONS_RADIO_RG1=	DOVECOT DOVECOT2
 OPTIONS_RADIO_RG2=	SASLKRB5 SASLKMIT
-OPTIONS_DEFAULT=	PCRE TLS
+OPTIONS_DEFAULT=	PCRE TLS EAI
 
 BDB_USE=		BDB=yes
 CDB_LIB_DEPENDS=	libcdb.so:${PORTSDIR}/databases/tinycdb
@@ -129,7 +130,7 @@ META_DIRECTORY=	${DAEMONDIR}
 
 SUB_LIST+=	REQUIRE="${_REQUIRE}" READMEDIR="${READMEDIR}" \
 		DAEMONDIR="${DAEMONDIR}" META_DIRECTORY="${META_DIRECTORY}"
-SUB_FILES+=	pkg-install pkg-message
+SUB_FILES+=	pkg-install pkg-message mailer.conf.postfix
 
 POSTFIX_CCARGS+=	-DDEF_CONFIG_DIR=\\\"${ETCDIR}\\\" \
 			-DDEF_DAEMON_DIR=\\\"${DAEMONDIR}\\\" \
@@ -199,8 +200,7 @@ POSTFIX_CCARGS+=	-DNO_TLS
 .if ${PORT_OPTIONS:MSPF}
 BROKEN=			At the moment, SPF support is unavailable for ${PORTNAME}-${DISTVERSION}
 PATCH_SITES+=		LOCAL/mm
-PATCHFILES+=		postfix-2.8.0-libspf2-1.2.x-0.patch.gz
-PATCH_DIST_STRIP=	-p1
+PATCHFILES+=		postfix-2.8.0-libspf2-1.2.x-0.patch.gz:-p1
 POSTFIX_CCARGS+=	-DHAVE_NS_TYPE -DHAS_SPF -I${LOCALBASE}/include
 POSTFIX_AUXLIBS+=	-L${LOCALBASE}/lib -lspf2
 .endif
@@ -368,6 +368,8 @@ post-stage:
 # == do not overwrite existing config
 	${MV} ${STAGEDIR}${ETCDIR}/main.cf ${STAGEDIR}${ETCDIR}/main.cf.sample
 	${MV} ${STAGEDIR}${ETCDIR}/master.cf ${STAGEDIR}${ETCDIR}/master.cf.sample
+	${MKDIR} ${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${WRKDIR}/mailer.conf.postfix ${STAGEDIR}${DATADIR}
 
 # == chop dynamicmaps.cf entries into dedicated .cf files
 # for future sub-packages support

Added: head/mail/postfix-current/files/mailer.conf.postfix.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/mail/postfix-current/files/mailer.conf.postfix.in	Mon Jan  4 10:31:51 2016	(r405233)
@@ -0,0 +1,7 @@
+#
+# Execute the Postfix sendmail program, named %%PREFIX%%/sbin/sendmail
+#
+sendmail	%%PREFIX%%/sbin/sendmail
+send-mail	%%PREFIX%%/sbin/sendmail
+mailq		%%PREFIX%%/sbin/sendmail
+newaliases	%%PREFIX%%/sbin/sendmail

Modified: head/mail/postfix-current/files/pkg-install.in
==============================================================================
--- head/mail/postfix-current/files/pkg-install.in	Mon Jan  4 10:23:33 2016	(r405232)
+++ head/mail/postfix-current/files/pkg-install.in	Mon Jan  4 10:31:51 2016	(r405233)
@@ -7,14 +7,18 @@
 # will make the port/package use defaults which make postfix replace
 # sendmail as much as possible.
 
-PREFIX=${PKG_PREFIX:=%%PREFIX%%}
-ETCDIR=${ETCDIR:=%%ETCDIR%%}
-DAEMONDIR=${DAEMONDIR:=%%DAEMONDIR%%}
-META_DIRECTORY=${META_DIRECTORY:=%%META_DIRECTORY%%}
-READMEDIR=${READMEDIR:=%%READMEDIR%%}
+# allowed vars during package installation
 BATCH=${BATCH:=no}
 POSTFIX_DEFAULT_MTA=${POSTFIX_DEFAULT_MTA:=no}
-MC=/etc/mail/mailer.conf
+
+# fixed vars
+PREFIX="%%PREFIX%%"
+ETCDIR="%%ETCDIR%%"
+DAEMONDIR="%%DAEMONDIR%%"
+META_DIRECTORY="%%META_DIRECTORY%%"
+READMEDIR="%%READMEDIR%%"
+MCP="%%DATADIR%%/mailer.conf.postfix"
+MC="/etc/mail/mailer.conf"
 
 if [ "${POSTFIX_DEFAULT_MTA}" = "no" ]; then
       DEFAULT_REPLACE_MAILERCONF=n
@@ -22,12 +26,6 @@ else
       DEFAULT_REPLACE_MAILERCONF=y
 fi
 
-if [ -x /usr/sbin/nologin ]; then
-      NOLOGIN=/usr/sbin/nologin
-else
-      NOLOGIN=/sbin/nologin
-fi
-
 ask() {
       local question default answer
 
@@ -57,6 +55,25 @@ yesno() {
       done
 }
 
+install_mailer_conf() {
+	echo "Activate Postfix in ${MC}"
+	/bin/mv -f ${MC} ${MC}.old
+	/usr/bin/install -m 644 ${MCP} ${MC}
+}
+
+show_not_activated_msg() {
+	echo
+	echo "==============================================================="
+	echo "Postfix was *not* activated in /etc/mail/mailer.conf! "
+	echo
+	echo "To finish installation run the following commands:"
+	echo
+	echo "  mv ${MC} ${MC}.old"
+	echo "  install -m 0644 ${MCP} ${MC}"
+	echo "==============================================================="
+	echo
+}
+
 if [ "$2" = "POST-INSTALL" ]; then
 	/bin/sh ${DAEMONDIR}/post-install tempdir=/tmp \
 	 daemon_directory=${DAEMONDIR} \
@@ -73,18 +90,22 @@ if [ "$2" = "POST-INSTALL" -a -z "${PACK
 	egrep -q "^newaliases.*${PREFIX}/sbin/sendmail"  ${MC}
 	ret=$?
 	if [ ${ret} -ne 0 ]; then
-		if yesno "Would you like to activate Postfix in ${MC}" ${DEFAULT_REPLACE_MAILERCONF}; then
-			/bin/mv -f ${MC} ${MC}.old
-			echo "#"						>	${MC}
-			echo -n "# Execute the Postfix sendmail program"	>>	${MC}
-			echo ", named ${PREFIX}/sbin/sendmail"			>>	${MC}
-			echo "#"						>>	${MC}
-			echo "sendmail	${PREFIX}/sbin/sendmail"	>>	${MC}
-			echo "send-mail	${PREFIX}/sbin/sendmail"	>>	${MC}
-			echo "mailq		${PREFIX}/sbin/sendmail"	>>	${MC}
-			echo "newaliases	${PREFIX}/sbin/sendmail"	>>	${MC}
+		# Respect POSTFIX_DEFAULT_MTA, do not ask for confirmation!
+		# (This helps tools like salt, ansible or puppet on new installations)
+		if [ "${DEFAULT_REPLACE_MAILERCONF}" = "y" ]; then
+			install_mailer_conf
+		elif [ "${DEFAULT_REPLACE_MAILERCONF}" = "n" -a -t 0 ]; then
+			if yesno "Would you like to activate Postfix in ${MC}" ${DEFAULT_REPLACE_MAILERCONF:="n"}; then
+				install_mailer_conf
+			else
+				show_not_activated_msg
+			fi
+		else
+			show_not_activated_msg
 		fi
 	else
+		echo "==============================================================="
 		echo "Postfix already activated in ${MC}"
+		echo "==============================================================="
 	fi
 fi

Modified: head/mail/postfix-current/files/pkg-message.in
==============================================================================
--- head/mail/postfix-current/files/pkg-message.in	Mon Jan  4 10:23:33 2016	(r405232)
+++ head/mail/postfix-current/files/pkg-message.in	Mon Jan  4 10:31:51 2016	(r405233)
@@ -1,22 +1,20 @@
-To enable postfix startup script please add postfix_enable="YES" in
-your rc.conf
+To use postfix instead of sendmail:
+  - clear sendmail queue and stop the sendmail daemons
 
-If you not need sendmail anymore, please add in your rc.conf:
-
-sendmail_enable="NO"
-sendmail_submit_enable="NO"
-sendmail_outbound_enable="NO"
-sendmail_msp_queue_enable="NO"
-
-And you can disable some sendmail specific daily maintenance routines in your
-/etc/periodic.conf file:
-
-daily_clean_hoststat_enable="NO"
-daily_status_mail_rejects_enable="NO"
-daily_status_include_submit_mailq="NO"
-daily_submit_queuerun="NO"
-
-If /etc/periodic.conf does not exist please create it and add those values.
+Run the following commands to enable postfix during startup:
+  - sysrc postfix_enable="YES"
+  - sysrc sendmail_enable="NONE"
+
+If postfix is *not* already activated in /etc/mail/mailer.conf
+  - mv /etc/mail/mailer.conf /etc/mail/mailer.conf.old
+  - install -m 0644 %%DAEMONDIR%%/mailer.conf.postfix /etc/mail/mailer.conf
+
+Disable sendmail(8) specific tasks,
+add the following lines to /etc/periodic.conf(.local):
+  daily_clean_hoststat_enable="NO"
+  daily_status_mail_rejects_enable="NO"
+  daily_status_include_submit_mailq="NO"
+  daily_submit_queuerun="NO"
 
 If you are using SASL, you need to make sure that postfix has access to read
 the sasldb file.  This is accomplished by adding postfix to group mail and

Modified: head/mail/postfix-current/pkg-plist
==============================================================================
--- head/mail/postfix-current/pkg-plist	Mon Jan  4 10:23:33 2016	(r405232)
+++ head/mail/postfix-current/pkg-plist	Mon Jan  4 10:31:51 2016	(r405233)
@@ -164,6 +164,7 @@ sbin/postmulti
 sbin/postsuper
 sbin/posttls-finger
 sbin/sendmail
+%%DATADIR%%/mailer.conf.postfix
 @dir libexec/postfix/dynamicmaps.cf.d
 @dir libexec/postfix/postfix-files.d
 @dir %%PFETC%%



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601041031.u04AVpAj043530>