#!/bin/sh -e


pre_rm() {
	local SVC="cni-mtn-configure"

	if [ -x /bin/systemctl -a -f /etc/systemd/system/${SVC}.service ] ; then
		if ! /bin/systemctl stop ${SVC} ; then
			echo "Cannot stop ${SVC} service!"
		fi
		if ! /bin/systemctl disable ${SVC} ; then
			echo "Cannot disable ${SVC} service!"
		fi
	fi
}


case "$1" in
	remove|purge)
		pre_rm
	;;

	failed-upgrade|upgrade|deconfigure)
	;;

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