#!/bin/sh
. /var/packages/VideoStation/scripts/common

case "$SYNOPKG_PKG_STATUS" in
	UNINSTALL)
		if [ "$pkgwizard_remove_db" = "true" ]; then
			CUSTOM_PLUGIN_PATH=$(jq .custom_plugin_dir ${PACKAGE_DIR}/etc/plugin.conf | sed 's/\"//g')
			if [ "$CUSTOM_PLUGIN_PATH" != "null" ]; then
				rm -rf ${CUSTOM_PLUGIN_PATH}/*
			fi
			rm -rf ${PACKAGE_DIR}/etc/*
		fi
	;;
	UPGRADE)
	;;
esac

exit 0
