#!/bin/sh

SERVICETOOL="/usr/syno/bin/servicetool"
RAD_D_HOOK_CERTIFICATE_TARGET="/usr/local/libexec/certificate.d"

if [ $SYNOPKG_PKG_STATUS != "UPGRADE" ]; then
	# remove port-forwarding config file and related firewall records
	${SERVICETOOL} --remove-configure-file --package synoradius_port
fi

# remove certificate configurations
rm -rf ${RAD_D_HOOK_CERTIFICATE_TARGET}/RadiusServer
synocrtunregister RadiusServer

exit 0
