#!/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

        chown -R $uid:icingaweb2 /run/icinga-vspheredb
    ;;

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

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

#DEBHELPER#

exit 0
