Prva verzija za buster.
[mod-security-cn.git] / debian / postrm
1 #!/bin/sh
2
3 set -e
4
5 # Debconf
6 . /usr/share/debconf/confmodule
7
8 PKG=mod-security-cn
9
10 MODSECLNK=/etc/apache2/conf-available/security2-cn.conf
11
12 # chk_conf_tag ()
13 #
14 #   Check if configuration file has CARNet package info lines.
15 #   return:  $RET => 0 - tagged
16 #                    1 - file does not exists
17 #                    2 - file exists, but it is not tagged
18 #
19 chk_conf_tag () {
20   local conf_file
21   conf_file="$1"
22   RET=1
23
24   if [ -f "$conf_file" ]; then
25     if egrep -q "^## Begin - Generated by CARNet package mod-security-cn$" "$conf_file"; then
26       RET=0
27     else
28       RET=2
29     fi
30   fi
31 }
32
33 if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
34   . /usr/share/apache2/apache2-maintscript-helper
35
36   modsecurity_enable() {
37     chk_conf_tag "$MODSECLNK"
38     if [ $RET -ne 2 ]; then
39       echo "CN: Purging $PKG configuration for Apache2."
40       return 0
41     fi
42     return 1
43     }
44 else
45   echo "CN: Could not load Apache 2.4 maintainer script helper."
46
47   modsecurity_enable() {
48     return 1
49   }
50 fi
51
52 if [ "$1" = "purge" ] ; then
53   if modsecurity_enable; then
54     apache2_invoke disconf security2-cn
55   fi
56 fi
57
58 #DEBHELPER#
59
60 exit 0