File: //var/lib/dpkg/info/imunify-ui-firewall-cpanel.prerm
#!/bin/bash
# prerm script for imunify360-firewall-cpanel
set -e
case "$1" in
purge|remove)
if [ ! -e /usr/local/cpanel/cpanel ] ; then
# No cPanel detected.
exit 0
fi
# remove plugin
/usr/share/av-userside-plugin.sh -r package="360"
# on uninstall
/usr/bin/imunify360-agent --console-log-level=WARNING disable-plugin
# Deleting i360's data from cPanel Service Monitor
sed -i '/^imunify360:/d' /etc/chkserv.d/chkservd.conf
# deleting /run/chkservd/restart_track/imunify360-* /run/chkservd/imunify360-*
find /var/run/chkservd -name imunify360 -exec rm {} \;
# restarting cPanel Service Monitor
/scripts/restartsrv_chkservd
# remove cpanel uploader hook
/usr/local/cpanel/bin/manage_hooks del script /usr/libexec/imunify360/cpanel_fileman_hook >/dev/null 2>&1 || true
exit 0
;;
upgrade)
;;
failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0