#!/bin/sh -e

if [ "$1" = "configure" ]; then
    if ! getent group designate > /dev/null 2>&1; then
        addgroup --system designate >/dev/null
    fi

    if ! getent passwd designate > /dev/null 2>&1; then
        adduser --system --home /var/lib/designate --ingroup designate --no-create-home --shell /bin/false designate
    fi

    chown -R designate:adm /var/log/designate
    chmod 0750 /var/log/designate
    chown -R designate:designate /var/lib/designate /etc/designate

    mkdir -p /var/lib/designate
    chown designate:designate /var/lib/designate
fi
#DEBHELPER#
