aboutsummaryrefslogtreecommitdiffstats
path: root/mail/exim/pkg-install
blob: 2665b5f04914e72f0da61d7c0a508ca088f7eebc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/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:=%%PREFIX%%}

user=%%EXIM_USER%%
group=%%EXIM_GROUP%%
logdir=%%LOGDIR%%

if [ "$2" = "PRE-INSTALL" ]; then
    if ! /usr/sbin/pw groupshow ${group} >/dev/null; then
        /usr/sbin/pw groupadd ${group} -g 125
    fi
    if ! /usr/sbin/pw usershow ${user} >/dev/null; then
        /usr/sbin/pw useradd ${user} -g ${group} -u 125 \
        -h - -d /var/spool/exim -s /nonexistent -c "Exim User"
    fi
    /bin/mkdir -p ${logdir}
    /usr/sbin/chown ${user}:${group} ${logdir}
fi

if [ "$2" = "POST-INSTALL" ]; then
    cf=$PKG_PREFIX/etc/exim/configure
    if [ -e $cf ]; then
        if /usr/bin/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 ! /usr/bin/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