summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorohauer <ohauer@FreeBSD.org>2016-01-04 10:31:51 +0000
committerohauer <ohauer@FreeBSD.org>2016-01-04 10:31:51 +0000
commita60a9e6fb839b8912bf5c07767ad2962e568a697 (patch)
tree5922c1db35bb385303911ff1c4994e311d5b78a7
parentad947a4ab5720cd3bb2ca4a99d534f66408d7058 (diff)
downloadFreeBSD-ports-a60a9e6fb839b8912bf5c07767ad2962e568a697.zip
FreeBSD-ports-a60a9e6fb839b8912bf5c07767ad2962e568a697.tar.gz
- 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
-rw-r--r--mail/postfix-current/Makefile10
-rw-r--r--mail/postfix-current/files/mailer.conf.postfix.in7
-rw-r--r--mail/postfix-current/files/pkg-install.in65
-rw-r--r--mail/postfix-current/files/pkg-message.in30
-rw-r--r--mail/postfix-current/pkg-plist1
5 files changed, 71 insertions, 42 deletions
diff --git a/mail/postfix-current/Makefile b/mail/postfix-current/Makefile
index 2702135..4a0d7eb 100644
--- a/mail/postfix-current/Makefile
+++ b/mail/postfix-current/Makefile
@@ -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_BASE LDAP LDAP_SASL LMDB MYSQL \
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
diff --git a/mail/postfix-current/files/mailer.conf.postfix.in b/mail/postfix-current/files/mailer.conf.postfix.in
new file mode 100644
index 0000000..08f2b2c
--- /dev/null
+++ b/mail/postfix-current/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
diff --git a/mail/postfix-current/files/pkg-install.in b/mail/postfix-current/files/pkg-install.in
index 5811aff..fd55444 100644
--- a/mail/postfix-current/files/pkg-install.in
+++ b/mail/postfix-current/files/pkg-install.in
@@ -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 "${PACKAGE_BUILDING}" -a -f "${MC}" ]; then
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
diff --git a/mail/postfix-current/files/pkg-message.in b/mail/postfix-current/files/pkg-message.in
index 826815e..3417b23 100644
--- a/mail/postfix-current/files/pkg-message.in
+++ b/mail/postfix-current/files/pkg-message.in
@@ -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:
+Run the following commands to enable postfix during startup:
+ - sysrc postfix_enable="YES"
+ - sysrc sendmail_enable="NONE"
-sendmail_enable="NO"
-sendmail_submit_enable="NO"
-sendmail_outbound_enable="NO"
-sendmail_msp_queue_enable="NO"
+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
-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.
+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
diff --git a/mail/postfix-current/pkg-plist b/mail/postfix-current/pkg-plist
index a2dadd2..cb14c96 100644
--- a/mail/postfix-current/pkg-plist
+++ b/mail/postfix-current/pkg-plist
@@ -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%%
OpenPOWER on IntegriCloud