-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
+PKG=mod-security-cn
+
+MODSECCONF=/etc/apache2/mod-security/$PKG.conf
+MODSECRBL=/etc/apache2/mod-security/rbl_lookup.conf
+MODSECLNK=/etc/apache2/conf-available/security2-cn.conf
+
+# chk_conf_tag ()
+#
+# Check if configuration file has CARNet package info lines.
+# return: $RET => 0 - tagged
+# 1 - file does not exists
+# 2 - file exists, but it is not tagged
+#
+chk_conf_tag () {
+ local conf_file
+ conf_file="$1"
+ RET=1
+
+ if [ -f "$conf_file" ]; then
+ if egrep -q "^## Begin - Generated by CARNet package mod-security-cn$" "$conf_file"; then
+ RET=0
+ else
+ RET=2
+ fi
+ fi
+}
+
+if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
+ . /usr/share/apache2/apache2-maintscript-helper
+
+ modsecurity_enable() {
+ chk_conf_tag "$MODSECLNK"
+ if [ $RET -ne 2 ]; then
+ echo "CN: Disabling $PKG configuration for Apache2."
+ return 0