summaryrefslogtreecommitdiff
path: root/mail/postfix/files
diff options
context:
space:
mode:
authorOlli Hauer <ohauer@FreeBSD.org>2016-02-25 20:09:56 +0000
committerOlli Hauer <ohauer@FreeBSD.org>2016-02-25 20:09:56 +0000
commit6a09303b9da1678c70f01f5d7dab123c291c68de (patch)
tree21905ca481aff27d98c4a77c6d4ecd0ad4927ed5 /mail/postfix/files
parentwww/session2: mark deprecated (diff)
- rework SASL OPTIONS
Dovecot SASL does not need any dependency, from now it will be always build into postfix and the default SASL unless Cyrus is also added (there is no conflict between them) - 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 - bump PORTREVISION Many Thanks to all testers! PR: 195662 PR: 205162
Diffstat (limited to 'mail/postfix/files')
-rw-r--r--mail/postfix/files/pkg-install.in127
-rw-r--r--mail/postfix/files/pkg-message.in6
-rw-r--r--mail/postfix/files/postfix.in5
3 files changed, 104 insertions, 34 deletions
diff --git a/mail/postfix/files/pkg-install.in b/mail/postfix/files/pkg-install.in
index 326c02880ffa..62733280ef9f 100644
--- a/mail/postfix/files/pkg-install.in
+++ b/mail/postfix/files/pkg-install.in
@@ -16,8 +16,13 @@ PREFIX="%%PREFIX%%"
ETCDIR="%%ETCDIR%%"
DAEMONDIR="%%DAEMONDIR%%"
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
@@ -54,25 +59,79 @@ 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 post-install to fix permissions and new config values
+# ==============================================================================
if [ "$2" = "POST-INSTALL" ]; then
/bin/sh ${DAEMONDIR}/post-install tempdir=/tmp \
daemon_directory=${DAEMONDIR} \
@@ -81,29 +140,35 @@ 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}
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}
+ 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/files/pkg-message.in b/mail/postfix/files/pkg-message.in
index 616e627c0a56..6ba402774402 100644
--- a/mail/postfix/files/pkg-message.in
+++ b/mail/postfix/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/files/postfix.in b/mail/postfix/files/postfix.in
index 216a3a5b21f0..74c1550bf984 100644
--- a/mail/postfix/files/postfix.in
+++ b/mail/postfix/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"