Inicijalna verzija paketa.
[mod-security-cn.git] / debian / config
1 #!/bin/sh
2
3 set -e
4
5 # Load debconf
6 . /usr/share/debconf/confmodule
7
8 if [ "$1" != reconfigure ]; then
9         db_fget mod-security-cn/rbl seen
10         if [ "$RET" = "true" ]; then
11             exit 0
12         fi
13 fi
14
15 A2DIR="/etc/apache2"
16 CONFDIR="$A2DIR/conf.d"
17 MODSECCONF="$CONFDIR/mod-security-cn.conf"
18
19
20 # chk_conf_tag ()
21 #
22 #   Check if configuration file has CARNet package info lines.
23 #   return:  $RET => 0 - tagged
24 #                    1 - file does not exists
25 #                    2 - file exists, but it is not tagged
26 #
27 chk_conf_tag () {
28
29         local conf_file
30         conf_file="$1"
31         RET=1
32         
33         if [ -f "$conf_file" ]; then
34             if egrep -q "^## Begin - Generated by CARNet package mod-security-cn$" "$conf_file"; then
35                 RET=0
36             else
37                 RET=2
38             fi
39         fi
40 }
41
42
43 # Check for CARNet ModSecurity configuration file.
44 #
45 chk_conf_tag "$MODSECCONF"
46 if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
47
48         # Configuration file is tagged or does not exist - ask user
49         # for RBL.
50         db_title mod-security-cn - konfiguracija
51         db_input critical mod-security-cn/rbl || true
52         db_go || true
53 else
54
55         # Configuration file is not tagged - skip question.
56         db_set mod-security-cn/rbl false || true
57         db_fset mod-security-cn/rbl seen true
58 fi
59
60 exit 0