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"
43 # Disable ModSecurity configuration.
44 chk_conf_tag "$MODSECCONF"
45 if [ $RET -eq 0 ]; then
46 if [ -e "$CONFDIR/mod-security-cn.conf" ]; then
47 cp_echo "CN: Disabling ModSecurity configuration."
48 rm -f "$CONFDIR/mod-security-cn.conf"
53 # Remove configuration files generated by this CARNet package.
54 for file in "$MODSECCONF" "$MODSECDIR/rbl_lookup.conf"; do
56 if [ $RET -eq 0 ]; then
57 cp_echo "CN: Removing configuration file $file"
63 # Restart Apache2 web server.
64 if [ $need_restart -eq 1 ]; then
65 if apache2ctl configtest 2>/dev/null; then
67 # Restart Apache2 web server.
68 if [ -x "/etc/init.d/apache2" ]; then
69 if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
70 invoke-rc.d apache2 restart || true
72 /etc/init.d/apache2 restart || true
76 # Something is broken.
77 cp_echo "CN: Your Apache2 configuration seem to be broken."
78 cp_echo "CN: Please, check the service configuration!"
87 upgrade|failed-upgrade)
90 echo "prerm called with unknown argument \$1'" >&2