aboutsummaryrefslogtreecommitdiffstats
path: root/dns/rbldnsd/pkg-install
blob: c51c36a6e7ae812a0bc216000552e323bcbc49eb (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
#!/bin/sh

if [ "$2" != "PRE-INSTALL" ]; then
    exit 0
fi

RBLDNSUSER=${RBLDNSUSER:-rbldns}
RBLDNSGROUP=${RBLDNSGROUP:-rbldns}

if ! pw groupshow "$RBLDNSGROUP" 2>/dev/null 1>&2; then
    if pw groupadd $RBLDNSGROUP; then
        echo "=> Added group \"$RBLDNSGROUP\"."
    else
                echo "=> Adding group \"$RBLDNSGROUP\" failed..."
                exit 1
        fi
fi

if ! pw usershow "$RBLDNSUSER" 2>/dev/null 1>&2; then
        if pw useradd $RBLDNSUSER -g $RBLDNSGROUP -h - \
                -s "/sbin/nologin" -d "/nonexistent" \
                -c "rbldnsd pseudo-user"; \
        then
                echo "=> Added user \"$RBLDNSUSER\"."
        else
                echo "=> Adding user \"$RBLDNSUSER\" failed..."
                exit 1
        fi
fi
exit 0