File: //var/lib/dpkg/info/imunify-ui-firewall-cpanel.postinst
#!/bin/bash
# postinst script for imunify360-firewall-cpanel
set -e
case "$1" in
configure)
if [ ! -e /usr/local/cpanel/cpanel ] ; then
echo No cPanel detected. Skipping setup.
exit 0
fi
/usr/bin/imunify360-agent --console-log-level=WARNING enable-plugin
# install/update vendors on rpm install/upgrade which increases
# probability for the possible error to be noted during testing and production use
/usr/bin/imunify360-agent --console-log-level=WARNING update modsec-rules > /dev/null
# installing i360 in cPanel Monitor Service, but not enabling it
grep -q "^imunify360:" /etc/chkserv.d/chkservd.conf || \
echo -e "imunify360:0\n" >> /etc/chkserv.d/chkservd.conf
# userside plugin
/usr/share/av-userside-plugin.sh -i package="360"
# clean WHM chkservd.conf from imunify360-captcha
sed -i '/imunify360-captcha:/d' /etc/chkserv.d/chkservd.conf
# fix service name for old installations (see DEF-7147)
sed -i s/imunify360-agent:/imunify360:/g /etc/chkserv.d/chkservd.conf
# restarting cPanel Service Monitor
/scripts/restartsrv_chkservd --reload
# iContact trigger script execution rights
chmod +x /usr/local/cpanel/whostmgr/docroot/cgi/imunify/handlers/notifyIE.cgi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0