#!/bin/sh
set -e

#DEBHELPER#

if [ "${1}" = "configure" ] && [ ! -z "${2}" ]; then
    if dpkg --compare-versions ${2} le "5.2.1+ds1-4~"; then
        if [ -d /etc/jupyterhub/config/jupyterhub_config.d ]; then
	    rmdir --ignore-fail-on-non-empty -p /etc/jupyterhub/config/jupyterhub_config.d
        fi

        if [ -d /etc/jupyterhub/config ]; then
	    rmdir --ignore-fail-on-non-empty -p /etc/jupyterhub/config
        fi
    fi
fi
