post_install() {

    set -e

    if [[ "$1" == "configure" ]]; then

        if ! getent group matemat >/dev/null; then
            groupadd --system matemat
        fi

        if ! getent passwd matemat >/dev/null; then
            useradd --system --create-home --gid matemat --home-dir /var/lib/matemat --shell /usr/bin/nologin matemat
        fi

        chown matemat:matemat -R /var/lib/matemat
        find /var/lib/matemat -type d -exec chmod 0750 {}
        find /var/lib/matemat -type f -exec chmod 0640 {}

        setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/matemat

    fi

}