summaryrefslogtreecommitdiffstats
path: root/debian/postinst
blob: 374209ce7e4d435f0da2d4e46d87c8f4c8014865 (plain)
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
#!/bin/sh
set -e

case "$1" in
    configure)
       SERVER_HOME=/var/lib/rspamd
       SERVER_LOG=/var/log/rspamd
       SERVER_USER=_rspamd

       adduser --quiet \
               --system \
               --group \
               --home $SERVER_HOME \
               --no-create-home \
               --disabled-login \
               --gecos "rspamd spam filtering system" \
               --force-badname \
               $SERVER_USER
       mkdir -p $SERVER_HOME $SERVER_LOG || true
       chown $SERVER_USER: $SERVER_HOME $SERVER_LOG
    ;;

    abort-*)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

if [ -x /etc/init.d/rspamd ]; then
    update-rc.d rspamd defaults >/dev/null
    if [ -d /run/systemd/system ]; then
        deb-systemd-invoke --system daemon-reload >/dev/null || true
        deb-systemd-invoke --system stop rspamd.service 2>/dev/null || true
    else
        invoke-rc.d rspamd start || exit $?
    fi
fi

#DEBHELPER#

exit 0