aboutsummaryrefslogtreecommitdiff
path: root/debian/postinst
blob: 9c80e676d34d5f4ecce78a72b5a9dea93769a931 (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
set -e

#DEBHELPER#

OUT=/dev/null
USERNAME=fuss
HOME=/var/www/fuss
SERVICE=fuss

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 "FUSS 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