summaryrefslogtreecommitdiffstats
path: root/debian/kea-common.postinst
blob: 61957be9813f03384cfe580d049b49f1ea51ef5d (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
#!/bin/sh
# postinst script for kea-common
#
# see: dh_installdeb(1)

set -e

case "$1" in
    configure)
        addgroup --force-badname --system _kea >/dev/null || exit 1
        adduser --force-badname --quiet --system --home /var/lib/kea \
           --shell /bin/false --no-create-home --disabled-password --disabled-login \
           --gecos "Kea DHCP User" --group _kea >/dev/null || exit 1

        # From version 2.2.0-2 we leave the handling of the /var/log/kea and
        # /var/lib/kea directories to systemd (creation and ownership/permissions
        # settings). When upgrading from kea-common (< 2.2.0-2) drop the now
        # useless dpkg-statoverrides.
        if [ "$2" != "" ] && dpkg --compare-versions "$2" lt "2.2.0-2"; then
            for d in /var/log/kea /var/lib/kea; do
                if dpkg-statoverride --list $d >/dev/null 2>&1; then
                    dpkg-statoverride --remove $d
                fi
            done
        fi
    ;;

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

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

#DEBHELPER#

exit 0