#!/bin/sh

set -e

if [ "$1" != "remove" ]; then
    exit 0
fi

echo "The kubernetes package has been removed."

if $(snap list|grep -q 'microk8s') >/dev/null; then
    echo ""
    echo "Note: microk8s is still installed and running on the system."
    echo ""
    echo "If the microk8s cluster is no longer needed, please run 'sudo snap remove microk8s'"
    echo ""
fi

if $(snap list|grep -q 'conjure-up') >/dev/null; then
    echo ""
    echo "Note: conjure-up is still installed on the system."
    if $(juju controllers >/dev/null 2>&1) && $(juju models|grep -q 'conjure'); then
        echo ""
        echo "Additionally, conjure-up has deployed juju controllers and models."
        echo "If those are no longer needed, please run 'juju destroy-model <model-name>' and"
        echo "'juju destroy-controller <controller-name>'."
    fi
    echo ""
    echo "If you no longer wish to use conjure-up to create new kubernetes "
    echo "deployments, please run 'sudo snap remove conjure-up'"
    echo ""
fi

#DEBHELPER#

exit 0
