diff options
Diffstat (limited to 'mail/postfix211/files')
-rw-r--r-- | mail/postfix211/files/mailer.conf.postfix.in | 7 | ||||
-rw-r--r-- | mail/postfix211/files/patch-makedefs | 12 | ||||
-rw-r--r-- | mail/postfix211/files/patch-src__util__sys_defs.h | 10 | ||||
-rw-r--r-- | mail/postfix211/files/pkg-install.in | 190 | ||||
-rw-r--r-- | mail/postfix211/files/pkg-message.in | 25 | ||||
-rw-r--r-- | mail/postfix211/files/postfix.in | 52 |
6 files changed, 296 insertions, 0 deletions
diff --git a/mail/postfix211/files/mailer.conf.postfix.in b/mail/postfix211/files/mailer.conf.postfix.in new file mode 100644 index 000000000000..08f2b2c00f35 --- /dev/null +++ b/mail/postfix211/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/postfix211/files/patch-makedefs b/mail/postfix211/files/patch-makedefs new file mode 100644 index 000000000000..56b0c3830fb5 --- /dev/null +++ b/mail/postfix211/files/patch-makedefs @@ -0,0 +1,12 @@ +--- makedefs.orig 2015-04-19 10:19:57 UTC ++++ makedefs +@@ -161,6 +161,9 @@ case "$SYSTEM.$RELEASE" in + FreeBSD.10*) SYSTYPE=FREEBSD10 + : ${CC=cc} + ;; ++ FreeBSD.11*) SYSTYPE=FREEBSD11 ++ : ${CC=cc} ++ ;; + DragonFly.*) SYSTYPE=DRAGONFLY + ;; + OpenBSD.2*) SYSTYPE=OPENBSD2 diff --git a/mail/postfix211/files/patch-src__util__sys_defs.h b/mail/postfix211/files/patch-src__util__sys_defs.h new file mode 100644 index 000000000000..d977481d19a1 --- /dev/null +++ b/mail/postfix211/files/patch-src__util__sys_defs.h @@ -0,0 +1,10 @@ +--- src/util/sys_defs.h.orig 2015-04-19 10:22:40 UTC ++++ src/util/sys_defs.h +@@ -26,6 +26,7 @@ + #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \ + || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \ + || defined(FREEBSD8) || defined(FREEBSD9) || defined(FREEBSD10) \ ++ || defined(FREEBSD11) \ + || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \ + || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \ + || defined(OPENBSD5) \ diff --git a/mail/postfix211/files/pkg-install.in b/mail/postfix211/files/pkg-install.in new file mode 100644 index 000000000000..73f621e3c934 --- /dev/null +++ b/mail/postfix211/files/pkg-install.in @@ -0,0 +1,190 @@ +#!/bin/sh +# +# $FreeBSD: /tmp/pcvs/ports/mail/postfix/files/pkg-install.in,v 1.6 2012-02-11 05:14:34 sahil Exp $ +# + +# If the POSTFIX_DEFAULT_MTA environment variable is set to YES, it +# will make the port/package use defaults which make postfix replace +# sendmail as much as possible. + +# allowed vars during package installation +BATCH=${BATCH:=no} +POSTFIX_DEFAULT_MTA=${POSTFIX_DEFAULT_MTA:=no} + +# fixed vars +PREFIX="%%PREFIX%%" +ETCDIR="%%ETCDIR%%" +DAEMONDIR="%%DAEMONDIR%%" +READMEDIR="%%READMEDIR%%" +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 +else + DEFAULT_REPLACE_MAILERCONF=y +fi + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" -a "${BATCH}" = "no" ]; then + read -p "${question} [${default}]? " answer + fi + if [ -z "${answer}" ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local question default answer + + question=$1 + default=$2 + while :; do + answer=$(ask "${question}" "${default}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +# ============================================================================== +# 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 ${mailerconf}! " + echo + echo "To finish installation run the following commands:" + echo + 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} \ + html_directory=${READMEDIR} \ + readme_directory=${READMEDIR} \ + upgrade-package +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 + cmp_mailer ${MC_LOCALBASE} || install_choise ${MC_LOCALBASE} + fi + else + cmp_mailer ${MC_BASE} + if [ $? -ne 0 ]; then + install_choise ${MC_BASE} + else + show_activated_msg ${MC_BASE} + try_reload + 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/postfix211/files/pkg-message.in b/mail/postfix211/files/pkg-message.in new file mode 100644 index 000000000000..6ba402774402 --- /dev/null +++ b/mail/postfix211/files/pkg-message.in @@ -0,0 +1,25 @@ +To use postfix instead of sendmail: + - clear sendmail queue and stop the sendmail daemons + +Run the following commands to enable postfix during startup: + - sysrc postfix_enable="YES" + - sysrc sendmail_enable="NONE" + +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): + 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 prior postfix version, review the RELEASE_NOTES to +familiarize yourself with new features and incompatabilities. diff --git a/mail/postfix211/files/postfix.in b/mail/postfix211/files/postfix.in new file mode 100644 index 000000000000..74c1550bf984 --- /dev/null +++ b/mail/postfix211/files/postfix.in @@ -0,0 +1,52 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: postfix mail +# REQUIRE: %%REQUIRE%% +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable postfix: +# postfix_enable (bool): Set it to "YES" to enable postfix. +# Default is "NO". +# postfix_pidfile (path): Set full path to master.pid. +# Default is "/var/spool/postfix/pid/master.pid". +# postfix_procname (command): Set command that start master. Used to verify if +# postfix is running. +# Default is "%%PREFIX%%/libexec/postfix/master". +# postfix_flags (str): Flags passed to postfix-script on startup. +# Default is "". +# + +. /etc/rc.subr + +name="postfix" +rcvar=postfix_enable + +load_rc_config $name + +: ${postfix_enable:="NO"} +: ${postfix_pidfile:="/var/spool/postfix/pid/master.pid"} +: ${postfix_procname:="%%PREFIX%%/libexec/postfix/master"} + +start_cmd=${name}_start +stop_cmd=${name}_stop +extra_commands="reload" +reload_cmd="${name}_reload" + +pidfile=${postfix_pidfile} +procname=${postfix_procname} + +postfix_start() { + %%PREFIX%%/sbin/postfix ${postfix_flags} start +} + +postfix_stop() { + %%PREFIX%%/sbin/postfix ${postfix_flags} stop +} + +postfix_reload() { + %%PREFIX%%/sbin/postfix ${postfix_flags} reload +} + +run_rc_command "$1" |