aboutsummaryrefslogtreecommitdiff
path: root/debian/postinst
blob: 1e4414419815e1bdcb225120f025cd2740e8486d (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
#!/bin/sh
# dep-devuan: lsb-base
set -e

#DEBHELPER#
OUT=/dev/null
USERNAME=stackbin
HOME=/var/stackbin
SERVICE=stackbin

case "$1" in
    configure)
        update-rc.d ${SERVICE} defaults
        if ! getent passwd ${USERNAME} 1>${OUT} 2>&1 ;
        then
            echo "Creating ${USERNAME} system user & group..."
            adduser --quiet --system --home $HOME \
                --disabled-password --group \
                --gecos "stackbin system user" \
                ${USERNAME} > ${OUT} 2>&1
        fi
        chown ${USERNAME}:${USERNAME} \
            ${HOME} ${HOME}/* \
            /var/log/${SERVICE} /var/log/${SERVICE}/*log 1>/${OUT} 2>&1 || :
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

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

exit 0
bgstack15