#!/bin/sh


set -e


#-------------------------------------------------------------------------


post_install() {
	if which grafana-cli >/dev/null ; then
		echo "Installing grafana-image-renderer plugin"
		grafana-cli plugins install grafana-image-renderer
	else
		echo
		echo "GET THE PLUGIN: "
		echo "grafana-cli plugins install grafana-image-renderer"
		echo
	fi
}


#-------------------------------------------------------------------------


case "$1" in
	configure)
		post_install
	;;

	abort-upgrade|abort-remove|abort-deconfigure)
	;;

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

#DEBHELPER#

exit 0
