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
18 if [ -f "$conf_file" ]; then
19 if egrep -q "^## Begin - Generated by CARNet package mod-security-cn$" "$conf_file"; then
31 # Include CARNet functions.
32 . /usr/share/carnet-tools/functions.sh
36 CONFDIR="$A2DIR/conf.d"
37 MODSECDIR="$A2DIR/mod-security"
38 MODSECCONF="$MODSECDIR/mod-security-cn.conf"
39 MODSECRBL="$MODSECDIR/rbl_lookup.conf"
40 MODSECLNK="$CONFDIR/$(basename $MODSECCONF)"
45 # Disable ModSecurity configuration.
46 chk_conf_tag "$MODSECCONF"
47 if [ $RET -eq 0 ]; then
48 if [ -e "$MODSECLNK" ]; then
49 cp_echo "CN: Disabling ModSecurity configuration."
55 # Remove configuration files generated by this CARNet package.
56 for file in "$MODSECCONF" "$MODSECRBL"; do
58 if [ $RET -eq 0 ]; then
59 cp_echo "CN: Removing configuration file $file"
65 # Restart Apache2 web server.
66 if [ $need_restart -eq 1 ]; then
67 if apache2ctl configtest 2>/dev/null; then
69 # Restart Apache2 web server.
70 if [ -x "/etc/init.d/apache2" ]; then
71 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
72 invoke-rc.d apache2 restart || true
74 /etc/init.d/apache2 restart || true
78 # Something is broken.
79 cp_echo "CN: Your Apache2 configuration seem to be broken."
80 cp_echo "CN: Please, check the service configuration!"
89 upgrade|failed-upgrade)
92 echo "prerm called with unknown argument \$1'" >&2