2001-06-11 09:20:20 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Since FreeBSD does not supply a user for running an MTA in a sandbox
|
2001-07-11 11:22:32 +00:00
|
|
|
# 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.
|
2001-06-11 09:20:20 +00:00
|
|
|
#
|
|
|
|
# Modern FreeBSD systems already have a group mail.
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
2004-01-31 15:27:22 +00:00
|
|
|
PKG_PREFIX=${PKG_PREFIX:=%%PREFIX%%}
|
2001-06-11 09:20:20 +00:00
|
|
|
|
2004-01-31 15:27:22 +00:00
|
|
|
user=%%EXIM_USER%%
|
|
|
|
group=%%EXIM_GROUP%%
|
2007-08-04 11:41:30 +00:00
|
|
|
logdir=%%LOGDIR%%
|
2001-06-11 09:20:20 +00:00
|
|
|
|
|
|
|
if [ "$2" = "PRE-INSTALL" ]; then
|
2002-09-12 10:09:02 +00:00
|
|
|
if ! /usr/bin/id ${user} > /dev/null; then
|
2006-01-07 22:48:20 +00:00
|
|
|
/usr/sbin/pw useradd ${EXIM_USER} -g ${EXIM_GROUP} -u 125 \
|
|
|
|
-h - -d /var/spool/exim -s /nonexistent -c "Exim User"
|
2001-12-11 12:34:54 +00:00
|
|
|
fi
|
2004-06-07 10:53:11 +00:00
|
|
|
if ! /usr/bin/grep -q "^${group}:" /etc/group; then
|
2006-01-07 22:48:20 +00:00
|
|
|
/usr/sbin/pw groupadd ${EXIM_GROUP} -g 125
|
2001-06-11 09:20:20 +00:00
|
|
|
fi
|
2004-06-07 10:53:11 +00:00
|
|
|
/bin/mkdir -p ${logdir}
|
|
|
|
/usr/sbin/chown ${user}:${group} ${logdir}
|
2001-06-11 09:20:20 +00:00
|
|
|
fi
|
|
|
|
|
2003-06-13 13:20:56 +00:00
|
|
|
if [ "$2" = "POST-INSTALL" ]; then
|
2007-08-04 11:41:30 +00:00
|
|
|
cf=$PKG_PREFIX/etc/exim/configure
|
2003-06-13 13:20:56 +00:00
|
|
|
if [ -e $cf ]; then
|
2003-09-29 11:42:45 +00:00
|
|
|
if /usr/bin/grep -q '^[^#]*hostlist.*relay_from_hosts.*=.*127.0.0.1' $cf
|
2003-06-13 13:20:56 +00:00
|
|
|
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
|
2007-08-04 11:41:30 +00:00
|
|
|
if ! /usr/bin/grep -qs "^exim_enable" /etc/rc.conf
|
2003-09-10 13:49:09 +00:00
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "Don't forget to add 'exim_enable=\"YES\"' to rc.conf(5)"
|
|
|
|
echo
|
|
|
|
fi
|
2003-06-13 13:20:56 +00:00
|
|
|
fi
|