Date: Mon, 4 Jan 2016 16:58:37 +0000 (UTC) From: Olli Hauer <ohauer@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org Subject: svn commit: r405252 - in branches/2016Q1/mail/postfix: . files Message-ID: <201601041658.u04Gwb1l067503@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ohauer Date: Mon Jan 4 16:58:37 2016 New Revision: 405252 URL: https://svnweb.freebsd.org/changeset/ports/405252 Log: MFH: r405234 - rework pkg-install and pkg-message [1] - install postfix specific mailer.conf.postfix into DATADIR [2] - 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) Approved by: portmgr (feld@) Added: branches/2016Q1/mail/postfix/files/mailer.conf.postfix.in - copied unchanged from r405234, head/mail/postfix/files/mailer.conf.postfix.in Modified: branches/2016Q1/mail/postfix/Makefile branches/2016Q1/mail/postfix/files/pkg-install.in branches/2016Q1/mail/postfix/files/pkg-message.in branches/2016Q1/mail/postfix/pkg-plist Directory Properties: branches/2016Q1/ (props changed) Modified: branches/2016Q1/mail/postfix/Makefile ============================================================================== --- branches/2016Q1/mail/postfix/Makefile Mon Jan 4 16:57:04 2016 (r405251) +++ branches/2016Q1/mail/postfix/Makefile Mon Jan 4 16:58:37 2016 (r405252) @@ -3,6 +3,7 @@ PORTNAME= postfix PORTVERSION= 2.11.7 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= mail ipv6 MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/ \ @@ -122,7 +123,7 @@ DAEMONDIR= ${PREFIX}/libexec/postfix SUB_LIST+= REQUIRE="${_REQUIRE}" READMEDIR="${READMEDIR}" \ DAEMONDIR="${DAEMONDIR}" -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}\\\" \ @@ -181,8 +182,7 @@ POSTFIX_CCARGS+= -DNO_TLS .if ${PORT_OPTIONS:MSPF} 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 @@ -237,9 +237,8 @@ _REQUIRE+= ypserv .endif .if ${PORT_OPTIONS:MVDA} -PATCH_SITES+= http://vda.sourceforge.net/VDA/:vda +PATCH_SITES+= http://vda.sourceforge.net/VDA/:-p1:vda PATCHFILES+= postfix-vda-v13-${VDAVERSION}.patch:vda -PATCH_DIST_STRIP= -p1 .endif .if ${PORT_OPTIONS:MTEST} @@ -348,6 +347,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} # Fix compressed man pages and strip executables ${SED} -i '' -E -e "s|(man[158]/.*.[158]):|\1.gz:|g" ${STAGEDIR}${DAEMONDIR}/postfix-files Copied: branches/2016Q1/mail/postfix/files/mailer.conf.postfix.in (from r405234, head/mail/postfix/files/mailer.conf.postfix.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/2016Q1/mail/postfix/files/mailer.conf.postfix.in Mon Jan 4 16:58:37 2016 (r405252, copy of r405234, head/mail/postfix/files/mailer.conf.postfix.in) @@ -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: branches/2016Q1/mail/postfix/files/pkg-install.in ============================================================================== --- branches/2016Q1/mail/postfix/files/pkg-install.in Mon Jan 4 16:57:04 2016 (r405251) +++ branches/2016Q1/mail/postfix/files/pkg-install.in Mon Jan 4 16:58:37 2016 (r405252) @@ -7,13 +7,17 @@ # 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%%} -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%%" +READMEDIR="%%READMEDIR%%" +MCP="%%DATADIR%%/mailer.conf.postfix" +MC="/etc/mail/mailer.conf" if [ "${POSTFIX_DEFAULT_MTA}" = "no" ]; then DEFAULT_REPLACE_MAILERCONF=n @@ -21,12 +25,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 @@ -56,6 +54,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} \ @@ -71,18 +88,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: branches/2016Q1/mail/postfix/files/pkg-message.in ============================================================================== --- branches/2016Q1/mail/postfix/files/pkg-message.in Mon Jan 4 16:57:04 2016 (r405251) +++ branches/2016Q1/mail/postfix/files/pkg-message.in Mon Jan 4 16:58:37 2016 (r405252) @@ -1,27 +1,25 @@ -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 making the %%PREFIX%%/etc/sasldb* file(s) readable by group mail (this should be the default for new installs). -If you are upgrading from Postfix 2.6 or earlier, review the RELEASE_NOTES to +If you are upgrading from prior postfix version, review the RELEASE_NOTES to familiarize yourself with new features and incompatabilities. Modified: branches/2016Q1/mail/postfix/pkg-plist ============================================================================== --- branches/2016Q1/mail/postfix/pkg-plist Mon Jan 4 16:57:04 2016 (r405251) +++ branches/2016Q1/mail/postfix/pkg-plist Mon Jan 4 16:58:37 2016 (r405252) @@ -137,6 +137,7 @@ sbin/postmulti sbin/postsuper sbin/posttls-finger sbin/sendmail +%%DATADIR%%/mailer.conf.postfix @dir %%PFETC%% @dir(postfix,,700) /var/db/postfix @dir(postfix,,700) /var/spool/postfix/active
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601041658.u04Gwb1l067503>