7 # Check if configuration file has CARNet package info lines.
8 # return: $RET => 0 - tagged
9 # 1 - file does not exists
10 # 2 - file exists, but it is not tagged
17 if [ -f "$conf_file" ]; then
18 if egrep -q "^## Begin - Generated by CARNet package mod-security-cn$" "$conf_file"; then
30 # Include CARNet functions.
31 . /usr/share/carnet-tools/functions.sh
35 CONFDIR="$A2DIR/conf.d"
36 MODSECDIR="$A2DIR/mod-security"
37 MODSECCONF="$MODSECDIR/mod-security-cn.conf"
38 MODSECRBL="$MODSECDIR/rbl_lookup.conf"
39 MODSECLNK="$CONFDIR/$(basename $MODSECCONF)"
44 # Disable ModSecurity configuration.
45 chk_conf_tag "$MODSECCONF"
46 if [ $RET -eq 0 ]; then
47 if [ -e "$MODSECLNK" ]; then
48 cp_echo "CN: Disabling ModSecurity configuration."
54 # Remove configuration files generated by this CARNet package.
55 for file in "$MODSECCONF" "$MODSECRBL"; do
57 if [ $RET -eq 0 ]; then
58 cp_echo "CN: Removing configuration file $file"
64 # Restart Apache2 web server.
65 if [ $need_restart -eq 1 ]; then
66 if apache2ctl configtest 2>/dev/null; then
67 invoke-rc.d apache2 force-reload || true
69 # Something is broken.
70 cp_echo "CN: Your Apache2 configuration seem to be broken."
71 cp_echo "CN: Please, check the service configuration!"
80 upgrade|failed-upgrade)
83 echo "prerm called with unknown argument \$1'" >&2