aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2003-09-10 21:49:09 +0800
committersheldonh <sheldonh@FreeBSD.org>2003-09-10 21:49:09 +0800
commitb353242d0289268e04964b597e20d2e97a6803b3 (patch)
tree80ed323b30e02e9cececc9e1aaf00343909cdea0 /mail
parenta26112da03b9e5cfa18bd9dcd8ff1c9ac3490bc3 (diff)
downloadfreebsd-ports-gnome-b353242d0289268e04964b597e20d2e97a6803b3.tar.gz
freebsd-ports-gnome-b353242d0289268e04964b597e20d2e97a6803b3.tar.zst
freebsd-ports-gnome-b353242d0289268e04964b597e20d2e97a6803b3.zip
Bring the Exim port closer to use as an install-time sendmail
replacement for FreeBSD: * Use an rc.subr start/stop script. * Include contributed periodic scripts. * Replace $PREFIX with the build-time value of PREFIX. * Generate a default configure file if it doesn't exist at install-time. * Remove the default configure file if it hasn't been modified at deinstall-time. * Install additional documentation. * Move creation and removal of /var/log/exim to pkg-plist. Bump PORTREVISION accordingly. This paves the way for ports/56458, which teaches sysinstall about Exim. Bug trhodes about that PR. :-) PR: ports/56450 Submitted by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
Diffstat (limited to 'mail')
-rw-r--r--mail/exim/Makefile61
-rw-r--r--mail/exim/files/150.exim-tidydb.sh34
-rw-r--r--mail/exim/files/460.exim-mail-rejects.sh68
-rw-r--r--mail/exim/files/POST-INSTALL-NOTES10
-rw-r--r--mail/exim/files/POST-INSTALL-NOTES.clamd2
-rw-r--r--mail/exim/files/POST-INSTALL-NOTES.exiscan-acl4
-rw-r--r--mail/exim/files/exim.sh82
-rw-r--r--mail/exim/pkg-install14
-rw-r--r--mail/exim/pkg-message2
-rw-r--r--mail/exim/pkg-plist29
10 files changed, 245 insertions, 61 deletions
diff --git a/mail/exim/Makefile b/mail/exim/Makefile
index b47ac4999465..d9a81338d188 100644
--- a/mail/exim/Makefile
+++ b/mail/exim/Makefile
@@ -7,7 +7,7 @@
PORTNAME= exim
PORTVERSION= 4.22
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_EXIM}
MASTER_SITE_SUBDIR= exim4
@@ -29,12 +29,20 @@ USE_BZIP2= yes
USE_PERL5= yes
MAN8= exim.8
+PORTDOC_FILES= ChangeLog Exim3.upgrade Exim4.upgrade NewStuff \
+ OptionLists.txt README README.SIEVE dbm.discuss.txt \
+ filter.txt pcrepattern.txt pcretest.txt spec.txt
+
+DAILY_SCRIPTS= 150.exim-tidydb 460.exim-mail-rejects
+
EXISCAN_ACL_VERSION= ${PORTVERSION}-12
PLIST_SUB+= EXIM_VERSION="${PORTVERSION}"
.if defined(NOPORTDOCS)
PKGMESSAGE= ${WRKDIR}/POST-INSTALL-NOTES
+.else
+PKGMESSAGE= ${WRKDIR}/pkg-message
.endif
MAKE_ENV+= OSTYPE=${OPSYS} ARCHTYPE=${MACHINE_ARCH} LOCALBASE=${LOCALBASE}
@@ -135,9 +143,25 @@ EXTRA_PATCHES+= `${FIND} ${PATCHDIR} -name 'wishlist-*.patch'`
.include <bsd.port.pre.mk>
-PORTDOC_FILES= Exim3.upgrade Exim4.upgrade OptionLists.txt README \
- dbm.discuss.txt filter.txt pcrepattern.txt pcretest.txt \
- spec.txt
+.if ${OSVERSION} >= 500038
+RC_SUBR?= ${DESTDIR}/etc/rc.subr
+RC_DIR= ${DESTDIR}/etc/rc.d
+RC_SUFX=
+.else
+USE_RC_SUBR= yes
+RC_DIR= ${PREFIX}/etc/rc.d
+RC_SUFX= .sh
+.endif
+
+SED_SCRIPT= -e 's,%%PREFIX%%,${PREFIX},g' \
+ -e 's,%%DOCSDIR%%,${DOCSDIR},g' \
+ -e 's,%%RC_SUBR%%,${RC_SUBR},g' \
+ -e 's,%%RC_DIR%%,${RC_DIR},g' \
+ -e 's,%%RC_SUFX%%,${RC_SUFX},g'
+
+PLIST_SUB+= RC_DIR=${RC_DIR} \
+ RC_SUFX=${RC_SUFX}
+
.if !defined(WITHOUT_EXISCAN)
PORTDOC_FILES+= exiscan-acl-examples.txt exiscan-acl-spec.txt
PLIST_SUB+= EXISCAN_ACL=""
@@ -326,28 +350,39 @@ pre-everything::
@${ECHO} ''
.endif
-post-patch:
+do-configure:
+ ${MKDIR} ${WRKSRC}/Local
+ ${SED} ${SEDLIST} ${WRKSRC}/src/EDITME > ${WRKSRC}/Local/Makefile
+
+post-build:
+.for script in exim ${DAILY_SCRIPTS}
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/${script}.sh > ${WRKDIR}/${script}.sh
+.endfor
.if !defined(WITHOUT_EXISCAN)
- @${CAT} ${FILESDIR}/POST-INSTALL-NOTES.exiscan-acl \
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES.exiscan-acl \
${FILESDIR}/POST-INSTALL-NOTES > ${WRKDIR}/POST-INSTALL-NOTES
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES.clamd > ${WRKDIR}/POST-INSTALL-NOTES.clamd
.else
- @${CAT} ${FILESDIR}/POST-INSTALL-NOTES > ${WRKDIR}/POST-INSTALL-NOTES
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/POST-INSTALL-NOTES > ${WRKDIR}/POST-INSTALL-NOTES
.endif
-
-do-configure:
- ${MKDIR} ${WRKSRC}/Local
- ${SED} ${SEDLIST} < ${WRKSRC}/src/EDITME > ${WRKSRC}/Local/Makefile
+ @${SED} ${SED_SCRIPT} ${MASTERDIR}/pkg-message > ${WRKDIR}/pkg-message
pre-install:
@PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
- ${INSTALL_SCRIPT} ${FILESDIR}/exim.sh ${PREFIX}/etc/rc.d
+ @${INSTALL_SCRIPT} ${WRKDIR}/exim.sh ${RC_DIR}/exim${RC_SUFX}
+ @${MKDIR} ${PREFIX}/etc/periodic/daily
+.for script in ${DAILY_SCRIPTS}
+ @${INSTALL_SCRIPT} ${WRKDIR}/${script}.sh ${PREFIX}/etc/periodic/daily/${script}
+.endfor
+ @[ -f ${PREFIX}/etc/exim/configure ] || \
+ ${CP} ${PREFIX}/etc/exim/configure.default ${PREFIX}/etc/exim/configure
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKDIR}/POST-INSTALL-NOTES ${DOCSDIR}
.if !defined(WITHOUT_EXISCAN)
- ${INSTALL_DATA} ${FILESDIR}/POST-INSTALL-NOTES.clamd ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKDIR}/POST-INSTALL-NOTES.clamd ${DOCSDIR}
.endif
.for docfile in ${PORTDOC_FILES}
${INSTALL_DATA} ${WRKSRC}/doc/${docfile} ${DOCSDIR}
diff --git a/mail/exim/files/150.exim-tidydb.sh b/mail/exim/files/150.exim-tidydb.sh
new file mode 100644
index 000000000000..5239368204ee
--- /dev/null
+++ b/mail/exim/files/150.exim-tidydb.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# Exim hints database maintenance
+#
+# contributed by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
+#
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]; then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+exim_tidydb_enable=${exim_tidydb_enable:-"YES"}
+exim_tidydb=${exim_tidydb:-"/usr/local/sbin/exim_tidydb"}
+exim_dbdir=${exim_dbdir:-"/var/spool/exim"}
+
+case "$exim_tidydb_enable" in
+ [Yy][Ee][Ss])
+ echo ""
+ echo "Tidying Exim hints databases:"
+ for db in "$exim_dbdir"/db/*.lockfile; do
+ echo ""
+ "$exim_tidydb" "$exim_dbdir" `basename $db .lockfile`
+ done
+ rc=1;;
+
+ *) rc=0;;
+esac
+
+exit $rc
diff --git a/mail/exim/files/460.exim-mail-rejects.sh b/mail/exim/files/460.exim-mail-rejects.sh
new file mode 100644
index 000000000000..f1cdc39babb9
--- /dev/null
+++ b/mail/exim/files/460.exim-mail-rejects.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# Check for rejected mail
+# Log lines that end with ' : IGNORE' will not be reported
+#
+# contributed by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
+#
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+exim_status_mail_rejects_enable=${exim_status_mail_rejects_enable:-"YES"}
+exim_status_mail_rejects_logs=${exim_status_mail_rejects_logs:-2}
+exim_rejectlog=${exim_rejectlog:-"/var/log/exim/rejectlog"}
+
+case "$exim_status_mail_rejects_enable" in
+ [Yy][Ee][Ss])
+ if [ ! -d `dirname "$exim_rejectlog"` ]
+ then
+ echo '$exim_status_mail_rejects_enable is set but' \
+ "`dirname "$exim_rejectlog"` doesn't exist"
+ rc=2
+ elif [ "$exim_status_mail_rejects_logs" -le 0 ]
+ then
+ echo '$exim_status_mail_rejects_enable is set but' \
+ '$exim_status_mail_rejects_logs is not greater than zero'
+ rc=2
+ else
+ echo
+ echo Checking for rejected mail:
+
+ start=`date -v-1d '+%Y-%m-%d'`
+ n=$(($exim_status_mail_rejects_logs - 2))
+ rc=$({
+ while [ $n -ge 0 ]
+ do
+ if [ -f "$exim_rejectlog.$n" ]
+ then
+ cat "$exim_rejectlog.$n"
+ elif [ -f "$exim_rejectlog.$n.gz" ]
+ then
+ zcat -fc "$exim_rejectlog.$n.gz"
+ elif [ -f "$exim_rejectlog.$n.bz2" ]
+ then
+ bzcat -fc "$exim_rejectlog.$n.bz2"
+ fi
+ n=$(($n - 1))
+ done
+ if [ -f "$exim_rejectlog" ]
+ then
+ cat "$exim_rejectlog"
+ fi
+ } |
+ grep -e "^$start" | grep -v ' : IGNORE$' | tee /dev/stderr | wc -l)
+ [ $rc -gt 0 ] && rc=1
+ fi;;
+
+ *) rc=0;;
+esac
+
+exit $rc
diff --git a/mail/exim/files/POST-INSTALL-NOTES b/mail/exim/files/POST-INSTALL-NOTES
index dc6c488fb8e6..cdeacff6f373 100644
--- a/mail/exim/files/POST-INSTALL-NOTES
+++ b/mail/exim/files/POST-INSTALL-NOTES
@@ -6,22 +6,22 @@ The following documentation has been installed:
In addition, plain text versions of these documents have been installed
as:
- ${PREFIX}/share/doc/exim/filter.txt
- ${PREFIX}/share/doc/exim/spec.txt
+ %%DOCSDIR%%/filter.txt
+ %%DOCSDIR%%/spec.txt
Postscript, PDF, HTML and plain text versions of these documents, as well
as a comprehensive FAQ list, are available at http://www.exim.org/ .
To use Exim instead of sendmail on startup:
-*) Create exim/configure from exim/configure.default .
*) Clear the sendmail queue and stop the sendmail daemon.
*) Adjust mailer.conf(5) as appropriate.
*) Set the 'sendmail_enable' rc.conf(5) variable to 'NONE'.
*) Set the 'daily_status_include_submit_mailq' and
'daily_clean_hoststat_enable' periodic.conf(5)
variables to 'NO'.
-*) Start exim with '${PREFIX}/etc/rc.d/exim.sh start'.
+*) Set the 'exim_enable' rc.conf(5) variable to 'YES'.
+*) Start exim with '%%RC_DIR%%/exim%%RC_SUFX%% start'.
You may also want to configure newsyslog(8) to rotate Exim log files:
@@ -36,6 +36,6 @@ now done by routers. Policy controls for incoming mail are now done by
Access Control Lists instead of separate options. All this means that
pre-4.00 configuration files have to be massively converted. If you
are coming from a 3.xx release, please read the document in the file
-${PREFIX}/share/doc/exim/Exim4.upgrade, and allow some time to complete
+%%DOCSDIR%%/Exim4.upgrade, and allow some time to complete
the upgrade.
diff --git a/mail/exim/files/POST-INSTALL-NOTES.clamd b/mail/exim/files/POST-INSTALL-NOTES.clamd
index cfc7b0ab405e..7ea8aad22694 100644
--- a/mail/exim/files/POST-INSTALL-NOTES.clamd
+++ b/mail/exim/files/POST-INSTALL-NOTES.clamd
@@ -38,7 +38,7 @@ It is important to follow them in sequence.
* Start clamd with /usr/local/etc/rc.d/clamd.sh start .
-* Start Exim with /usr/local/etc/rc.d/exim.sh start .
+* Start Exim with %%RC_DIR%%/exim%%RC_SUFX%% start .
Sheldon Hearn <sheldonh@FreeBSD.org>
diff --git a/mail/exim/files/POST-INSTALL-NOTES.exiscan-acl b/mail/exim/files/POST-INSTALL-NOTES.exiscan-acl
index 148e6d1fe082..2cd1fc11363c 100644
--- a/mail/exim/files/POST-INSTALL-NOTES.exiscan-acl
+++ b/mail/exim/files/POST-INSTALL-NOTES.exiscan-acl
@@ -1,11 +1,11 @@
This installation of Exim includes Exiscan content scanning support,
from http://duncanthrax.net/exiscan-acl/, which is documented in
-${PREFIX}/share/doc/exim/exiscan-acl-spec.txt. The ports tree
+%%DOCSDIR%%/exiscan-acl-spec.txt. The ports tree
includes various content scanners that might be useful, e.g.
mail/p5-Mail-SpamAssassin and security/clamav.
Notes for enabling malware scanning with the excellent clamd scanner
-are in ${PREFIX}/share/doc/exim/POST-INSTALL-NOTES.clamd.
+are in %%DOCSDIR%%/POST-INSTALL-NOTES.clamd.
When Exiscan is actually enabled in the Exim configure file, great
care should be taken to test upgrades, since Exiscan updates tend
diff --git a/mail/exim/files/exim.sh b/mail/exim/files/exim.sh
index 3b58c00fa14f..cac669b06d41 100644
--- a/mail/exim/files/exim.sh
+++ b/mail/exim/files/exim.sh
@@ -2,29 +2,63 @@
#
# $FreeBSD$
#
-# Note that 'pidfile' may need to be changed if 'args' is altered; see
-# the description of the 'pid_file_path' Exim configuration option in
-# the Exim Specification.
+
+# PROVIDE: mail
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD shutdown
+# we make mail start late, so that things like .forward's are not
+# processed until the system is fully operational
+
+#
+# Add the following lines to /etc/rc.conf to enable exim:
+#
+#exim_enable="YES"
#
-args='-bd -q30m'
-pidfile='/var/run/exim.pid'
-
-case "$1" in
-start)
- [ -x /usr/local/sbin/exim ] && /usr/local/sbin/exim ${args} && \
- echo -n ' exim'
- ;;
-stop)
- kill `cat ${pidfile}` && echo -n ' exim'
- ;;
-reload)
- kill -HUP `cat ${pidfile}` && echo -n ' exim'
- ;;
-*)
- echo "Usage: `basename $0` {start|stop|reload}" >&2
- exit 64
- ;;
-esac
-
-exit 0
+# See exim(8) for flags
+#
+
+. %%RC_SUBR%%
+
+name=exim
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/exim
+pidfile=/var/run/exim.pid
+required_dirs=/var/log/exim
+required_files=%%PREFIX%%/etc/exim/configure
+
+start_precmd=start_precmd
+stop_postcmd=stop_postcmd
+
+extra_commands="reload"
+
+start_precmd()
+{
+ case $sendmail_enable in
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ warn "sendmail_enable should be set to NONE"
+ ;;
+ [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
+ case $sendmail_submit_enable in
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+ warn "sendmail_submit_enable should be set to NO"
+ ;;
+ esac
+ ;;
+ [Nn][Oo][Nn][Ee])
+ ;;
+ esac
+}
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+# set defaults
+
+exim_enable=${exim_enable:-"NO"}
+exim_flags=${exim_flags:-"-bd -q30m"}
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/exim/pkg-install b/mail/exim/pkg-install
index 317e09529e98..d9f99317e393 100644
--- a/mail/exim/pkg-install
+++ b/mail/exim/pkg-install
@@ -46,12 +46,10 @@ if [ "$2" = "POST-INSTALL" ]; then
echo "============================================================"
fi
fi
+ if ! grep -qs "^exim_enable" /etc/rc.conf
+ then
+ echo
+ echo "Don't forget to add 'exim_enable=\"YES\"' to rc.conf(5)"
+ echo
+ fi
fi
-
-# This is naughty, since the directory we create won't be removed along
-# with Exim. However, logfiles should probably stick around after Exim
-# is removed, until the administrator is sure he doesn't want them
-# any more.
-#
-mkdir -p /var/log/exim
-chown ${user}:${group} /var/log/exim
diff --git a/mail/exim/pkg-message b/mail/exim/pkg-message
index 83859714c92b..93c1abab9ee5 100644
--- a/mail/exim/pkg-message
+++ b/mail/exim/pkg-message
@@ -2,6 +2,6 @@
IMPORTANT NOTE:
===============
-Please read ${PREFIX}/share/doc/exim/POST-INSTALL-NOTES for important
+Please read %%DOCSDIR%%/POST-INSTALL-NOTES for important
information regarding your Exim installation.
diff --git a/mail/exim/pkg-plist b/mail/exim/pkg-plist
index c5736bf47b6f..84ee32b35ea7 100644
--- a/mail/exim/pkg-plist
+++ b/mail/exim/pkg-plist
@@ -1,5 +1,5 @@
-etc/exim/configure.default
-etc/rc.d/exim.sh
+@comment $FreeBSD$
+@unexec [ ! -f /var/run/exim.pid ] || %%RC_DIR%%/exim%%RC_SUFX%% stop || true
sbin/exim
sbin/exim-%%EXIM_VERSION%%-1
sbin/exim_checkaccess
@@ -15,18 +15,33 @@ sbin/exigrep
sbin/eximstats
sbin/exiqgrep
sbin/exiqsumm
-%%PORTDOCS%%%%DOCSDIR%%/POST-INSTALL-NOTES
+%%PORTDOCS%%%%DOCSDIR%%/ChangeLog
%%PORTDOCS%%%%DOCSDIR%%/Exim3.upgrade
%%PORTDOCS%%%%DOCSDIR%%/Exim4.upgrade
+%%PORTDOCS%%%%DOCSDIR%%/NewStuff
%%PORTDOCS%%%%DOCSDIR%%/OptionLists.txt
+%%PORTDOCS%%%%DOCSDIR%%/POST-INSTALL-NOTES
+%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/POST-INSTALL-NOTES.clamd
%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/README.SIEVE
%%PORTDOCS%%%%DOCSDIR%%/dbm.discuss.txt
+%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/exiscan-acl-examples.txt
+%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/exiscan-acl-spec.txt
%%PORTDOCS%%%%DOCSDIR%%/filter.txt
%%PORTDOCS%%%%DOCSDIR%%/pcrepattern.txt
%%PORTDOCS%%%%DOCSDIR%%/pcretest.txt
%%PORTDOCS%%%%DOCSDIR%%/spec.txt
-%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/POST-INSTALL-NOTES.clamd
-%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/exiscan-acl-examples.txt
-%%PORTDOCS%%%%EXISCAN_ACL%%%%DOCSDIR%%/exiscan-acl-spec.txt
-@dirrm etc/exim
%%PORTDOCS%%@dirrm %%DOCSDIR%%
+etc/periodic/daily/150.exim-tidydb
+etc/periodic/daily/460.exim-mail-rejects
+@unexec rmdir %D/etc/periodic/daily 2>/dev/null || true
+@unexec rmdir %D/etc/periodic 2>/dev/null || true
+@unexec if cmp -s %D/etc/exim/configure %D/etc/exim/configure.default; then rm -f %D/etc/exim/configure; fi
+etc/exim/configure.default
+@exec [ -f %B/configure ] || cp %B/%f %B/configure
+@unexec rmdir %B 2>/dev/null || true
+@cwd %%RC_DIR%%
+exim%%RC_SUFX%%
+@exec mkdir -p /var/log/exim
+@exec chown mailnull:mail /var/log/exim
+@unexec rmdir /var/log/exim 2>/dev/null || true