aboutsummaryrefslogtreecommitdiffstats
path: root/mail/majordomo/pkg-install
blob: 4aa33ecc00a3930268bc716dab213a6d68c2a577 (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
#!/bin/sh
# $FreeBSD$

MAJORDOMOUSER=majordom
MAJORDOMOGROUP=majordom
UID=54
GID=$UID

case $2 in
PRE-INSTALL|ADDUSER)
    if ! pw groupshow ${MAJORDOMOGROUP} 2>/dev/null 1>&2; then
        if pw groupadd ${MAJORDOMOGROUP} -g $GID; then
            echo "=> Added group \"${MAJORDOMOGROUP}\"."
        else
            echo "=> Adding group \"${MAJORDOMOGROUP}\" failed..."
            exit 1
        fi
    fi

    if ! pw usershow ${MAJORDOMOUSER} 2>/dev/null 1>&2; then
        if pw useradd ${MAJORDOMOUSER} -u $UID -g ${MAJORDOMOGROUP} -h - \
            -s "/nonexistent" -d "/usr/local/majordomo" \
            -c "Majordomo Pseudo User"; \
        then
            pw groupmod ${MAJORDOMOGROUP} -m ${MAJORDOMOUSER}
            echo "=> Added user \"${MAJORDOMOUSER}\"."
        else
            echo "=> Adding user \"${MAJORDOMOUSER}\" failed..."
            exit 1
        fi
    fi
    ;;
POST-INSTALL)
    # Add misc empty dirs, correct permissions
    for dir in tmp lists/test-l.archive lists/test-l-digest.archive digests/test-l-digest; do
        mkdir -p ${PKG_PREFIX}/majordomo/$dir
    done
    chown -R majordom:majordom ${PKG_PREFIX}/majordomo
    chmod 700 ${PKG_PREFIX}/majordomo/tmp
    chmod 755 ${PKG_PREFIX}/majordomo
    for dir in digests lists/*.archive digests/test-l-digest; do
        chmod 775 ${PKG_PREFIX}/majordomo/$dir
    done
    if [ x"${NOPORTDOCS}" = x ]; then
        mkdir -p ${PKG_PREFIX}/majordomo/doc
        chmod 775 ${PKG_PREFIX}/majordomo/doc
    fi
    chmod 755 ${PKG_PREFIX}/majordomo/lists ${PKG_PREFIX}/majordomo
    ;;
esac

exit 0