freebsd-ports/mail/exim/pkg-install
Sheldon Hearn 55c1140415 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>
2003-09-10 13:49:09 +00:00

55 lines
1.7 KiB
Bash

#!/bin/sh
#
# Since FreeBSD does not supply a user for running an MTA in a sandbox
# by default, use user 'exim', adding it if it does not exist. Even
# if FreeBSD supplied an MTA user, it's neglected to do so for so long
# that every sandboxed MTA under the sun uses its own user, so user
# 'exim' should probably be used forever.
#
# Modern FreeBSD systems already have a group mail.
#
# $FreeBSD$
#
PKG_PREFIX=${PKG_PREFIX:=/usr/local}
user=mailnull
group=mail
if [ "$2" = "PRE-INSTALL" ]; then
if ! /usr/bin/id ${user} > /dev/null; then
echo "Exim requires user ${user}. Please update your system." 1>&2
exit 1
fi
if ! /usr/bin/grep -q "^${group}:" < /etc/group; then
echo "Exim requires group ${group}. Please update your system." 1>&2
exit 1
fi
fi
if [ "$2" = "POST-INSTALL" ]; then
cf=$PKG_PREFIX/etc/exim/configure
if [ -e $cf ]; then
if grep -q '^[^#]*hostlist.*relay_from_hosts.*=.*127.0.0.1' $cf
then
echo
echo "============================================================"
echo " !!! WARNING !!! "
echo "============================================================"
echo
echo "Existing configure file $cf"
echo "contains 127.0.0.1 in relay_from_hosts hostlist!"
echo "Use of localhost instead of 127.0.0.1 is highly recommended."
echo
echo "============================================================"
echo " !!! WARNING !!! "
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