#!/bin/sh

set -e

shortname=vspheredb
uid=icinga$shortname

case "$1" in
    configure)
        # Only on install
        if ! getent passwd "$uid" >/dev/null; then
            useradd -r -g icingaweb2 -d /run/icinga-vspheredb -s /sbin/nologin "$uid"
        fi

        if [ -z "$2" ]; then
            ln -sf "/usr/share/icingaweb2/modules/$shortname" "/etc/icingaweb2/enabledModules/$shortname"
        fi
    ;;

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

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

#DEBHELPER#

exit 0
