diff options
author | Olli Hauer <ohauer@FreeBSD.org> | 2016-02-25 20:26:08 +0000 |
---|---|---|
committer | Olli Hauer <ohauer@FreeBSD.org> | 2016-02-25 20:26:08 +0000 |
commit | 0891faea7c7c8350c97aeb7d5ddfe46248ee16f8 (patch) | |
tree | 0150bdead322cb366147106608876e0cd3c77bbc /mail/postfix-current/files | |
parent | Update databases/elixir-db_connection to version 0.2.4. (diff) |
- update to 3.0.4
- rework SASL OPTIONS
Dovecot SASL does not need any dependency, from now it will be always build into postfix
- EAI is now mandantory, else mails can be lost
- add support for FreeBSD 10.3 mailwrapper (install mailer.conf into LOCALBASE/mail instead /etc/mail)
- add better reload support to rc script
- display correct path in pkg-message
- add support for postfix-sasl slave port
- remove nativ SPF support, patch is no longer maintained and there are alternatives in the ports tree
- remove VDA support (seems VDA project is dead and unmaintaned)
Many Thanks to all testers!
PR: 195662
PR: 205162
Notes
Notes:
svn path=/head/; revision=409556
Diffstat (limited to 'mail/postfix-current/files')
-rw-r--r-- | mail/postfix-current/files/pkg-install.in | 143 | ||||
-rw-r--r-- | mail/postfix-current/files/pkg-message.in | 6 | ||||
-rw-r--r-- | mail/postfix-current/files/postfix.in | 5 |
3 files changed, 120 insertions, 34 deletions
diff --git a/mail/postfix-current/files/pkg-install.in b/mail/postfix-current/files/pkg-install.in index fd554446b319..16868ef58b68 100644 --- a/mail/postfix-current/files/pkg-install.in +++ b/mail/postfix-current/files/pkg-install.in @@ -17,8 +17,13 @@ ETCDIR="%%ETCDIR%%" DAEMONDIR="%%DAEMONDIR%%" META_DIRECTORY="%%META_DIRECTORY%%" READMEDIR="%%READMEDIR%%" -MCP="%%DATADIR%%/mailer.conf.postfix" -MC="/etc/mail/mailer.conf" +MC_TEMPLATE="%%DATADIR%%/mailer.conf.postfix" + +# FreeBSD <= 10.3 +MC_BASE="/etc/mail/mailer.conf" +# FreeBSD >= 10.3 (and current) +MC_LOCALBASE="%%LOCALBASE%%/etc/mail/mailer.conf" +USE_LOCALBASE_MAILER_CONF="%%USE_LOCALBASE_MAILER_CONF%%" if [ "${POSTFIX_DEFAULT_MTA}" = "no" ]; then DEFAULT_REPLACE_MAILERCONF=n @@ -55,25 +60,93 @@ yesno() { done } -install_mailer_conf() { - echo "Activate Postfix in ${MC}" - /bin/mv -f ${MC} ${MC}.old - /usr/bin/install -m 644 ${MCP} ${MC} +# ============================================================================== +# Respect POSTFIX_DEFAULT_MTA, do not ask for confirmation! +# (This helps tools like salt, ansible or puppet on new installations) +# ============================================================================== +install_choise(){ + local mailerconf + mailerconf=$1 + + if [ "${DEFAULT_REPLACE_MAILERCONF}" = "y" ]; then + install_mailer_conf ${mailerconf} + elif [ "${DEFAULT_REPLACE_MAILERCONF}" = "n" -a -t 0 ]; then + if yesno "Would you like to activate Postfix in ${mailerconf}" ${DEFAULT_REPLACE_MAILERCONF:="n"}; then + install_mailer_conf ${mailerconf} + else + show_not_activated_msg ${mailerconf} + fi + else + show_not_activated_msg ${mailerconf} + fi } show_not_activated_msg() { + local mailerconf + + mailerconf=$1 echo echo "===============================================================" - echo "Postfix was *not* activated in /etc/mail/mailer.conf! " + echo "Postfix was *not* activated in ${mailerconf}! " echo echo "To finish installation run the following commands:" echo - echo " mv ${MC} ${MC}.old" - echo " install -m 0644 ${MCP} ${MC}" + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + echo " mkdir -p %%LOCALBASE%%/etc/mail" + else + echo " mv -f ${mailerconf} ${mailerconf}.old" + fi + echo " install -m 0644 ${MC_TEMPLATE} ${mailerconf}" echo "===============================================================" echo } +show_activated_msg() { + local mailerconf + + mailerconf=$1 + echo "===============================================================" + echo "Postfix already activated in ${mailerconf}" + echo "===============================================================" +} + +cmp_mailer() { + local mailerconf + + mailerconf=$1 + cmp -s ${mailerconf} ${MC_TEMPLATE} + return $? +} + +install_mailer_conf() { + local mailerconf + + mailerconf=$1 + echo "Activate Postfix in ${mailerconf}" + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + [ -d %%LOCALBASE%%/etc/mail ] || mkdir -p %%LOCALBASE%%/etc/mail + fi + [ -f ${mailerconf} ] && mv -f ${mailerconf} ${mailerconf}.old + install -m 644 ${MC_TEMPLATE} ${mailerconf} +} + +# ============================================================================== +# Run postfix reload +# This is a candidate for a dedicated pkg-post-upgrade script, but it seems +# this not fully implemented in pkg :(see upstream PR 941) +# ============================================================================== +try_reload(){ + ${PREFIX}/sbin/postfix status 2>/dev/null +if [ $? -eq 0 ]; then + ${PREFIX}/sbin/postfix reload +else + echo "postfix not running" +fi +} + +# ============================================================================== +# Run postfix post-install to fix permissions and new config values +# ============================================================================== if [ "$2" = "POST-INSTALL" ]; then /bin/sh ${DAEMONDIR}/post-install tempdir=/tmp \ daemon_directory=${DAEMONDIR} \ @@ -83,29 +156,37 @@ if [ "$2" = "POST-INSTALL" ]; then upgrade-package fi -if [ "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" -a -f "${MC}" ]; then - egrep -q "^sendmail.*${PREFIX}/sbin/sendmail" ${MC} && \ - egrep -q "^send-mail.*${PREFIX}/sbin/sendmail" ${MC} && \ - egrep -q "^mailq.*${PREFIX}/sbin/sendmail" ${MC} && \ - egrep -q "^newaliases.*${PREFIX}/sbin/sendmail" ${MC} - ret=$? - if [ ${ret} -ne 0 ]; then - # 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 +# ============================================================================== +# If FreeBSD <= 10.2 is deprecated check only LOCALBASE and remove BASE checks, +# regardless if installed in BASE or LOCALBASE +# Iff postfix is activated in BASE, also activate postfix in LOCALBASE! +# ============================================================================== +if [ "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" ]; then +if [ -f "${MC_BASE}" ]; then + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + cmp_mailer ${MC_BASE} + if [ $? -eq 0 ]; then + show_activated_msg ${MC_BASE} + cmp_mailer ${MC_LOCALBASE} || install_mailer_conf ${MC_LOCALBASE} + try_reload else - show_not_activated_msg + cmp_mailer ${MC_LOCALBASE} || install_choise ${MC_LOCALBASE} fi else - echo "===============================================================" - echo "Postfix already activated in ${MC}" - echo "===============================================================" + cmp_mailer ${MC_BASE} + if [ $? -ne 0 ]; then + install_choise ${MC_BASE} + else + show_activated_msg ${MC_BASE} + try_reload + fi fi -fi + +else + if [ "${USE_LOCALBASE_MAILER_CONF}" = "yes" ]; then + show_not_activated_msg ${MC_LOCALBASE} + else + show_not_activated_msg ${MC_BASE} + fi +fi # -f "${MC_BASE}" +fi # "$2" = "POST-INSTALL" -a -z "${PACKAGE_BUILDING}" diff --git a/mail/postfix-current/files/pkg-message.in b/mail/postfix-current/files/pkg-message.in index 3417b23d98b2..70c7569d08c1 100644 --- a/mail/postfix-current/files/pkg-message.in +++ b/mail/postfix-current/files/pkg-message.in @@ -5,9 +5,9 @@ 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 +If postfix is *not* already activated in %%MC_PREFIX%%/etc/mail/mailer.conf + - mv %%MC_PREFIX%%/etc/mail/mailer.conf %%MC_PREFIX%%/etc/mail/mailer.conf.old + - install -m 0644 %%DATADIR%%/mailer.conf.postfix %%MC_PREFIX%%/etc/mail/mailer.conf Disable sendmail(8) specific tasks, add the following lines to /etc/periodic.conf(.local): diff --git a/mail/postfix-current/files/postfix.in b/mail/postfix-current/files/postfix.in index 216a3a5b21f0..74c1550bf984 100644 --- a/mail/postfix-current/files/postfix.in +++ b/mail/postfix-current/files/postfix.in @@ -32,6 +32,7 @@ load_rc_config $name start_cmd=${name}_start stop_cmd=${name}_stop extra_commands="reload" +reload_cmd="${name}_reload" pidfile=${postfix_pidfile} procname=${postfix_procname} @@ -44,4 +45,8 @@ postfix_stop() { %%PREFIX%%/sbin/postfix ${postfix_flags} stop } +postfix_reload() { + %%PREFIX%%/sbin/postfix ${postfix_flags} reload +} + run_rc_command "$1" |