#!/bin/sh set -e case "$1" in remove|deconfigure) # Include CARNet functions. . /usr/share/carnet-tools/functions.sh PKG="mod-security-cn" A2DIR="/etc/apache2" CONFDIR="$A2DIR/conf.d" MODSECCONF="$CONFDIR/mod-security-cn.conf" need_restart=0 # Remove configuration file generated by this CARNet package. if [ -f "$MODSECCONF" ]; then if egrep -q "^## Begin - Generated by CARNet package mod-security-cn$" "$MODSECCONF"; then cp_echo "CN: Removing configuration file ${MODSECCONF}." rm -f $MODSECCONF need_restart=1 fi fi # Restart Apache2 web server. if [ $need_restart -eq 1 ]; then if apache2ctl configtest 2>/dev/null; then # Restart Apache2 web server. if [ -x "/etc/init.d/apache2" ]; then if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then invoke-rc.d apache2 restart || true else /etc/init.d/apache2 restart || true fi fi else # Something is broken. cp_echo "CN: Your Apache2 configuration seem to be broken." cp_echo "CN: Please, check the service configuration!" fi fi # Mail root cp_mail "$PKG" echo ;; upgrade|failed-upgrade) ;; *) echo "prerm called with unknown argument \$1'" >&2 exit 0 ;; esac exit 0