Prva inacica paketa za Debian squeeze distribuciju.
[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 MODSECDIR="$A2DIR/mod-security"
17 MODSECCONF="$MODSECDIR/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     local conf_file
29     conf_file="$1"
30     RET=1
31
32     if [ -f "$conf_file" ]; then
33         if egrep -q "^## Begin - Generated by CARNet package mod-security-cn$" "$conf_file"; then
34             RET=0
35         else
36             RET=2
37         fi
38     fi
39 }
40
41
42 # Check for CARNet ModSecurity configuration file.
43 #
44 chk_conf_tag "$MODSECCONF"
45 if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
46     # Configuration file is tagged or does not exist - ask user
47     # for RBL.
48     db_title mod-security-cn - konfiguracija
49     db_input critical mod-security-cn/rbl || true
50     db_go || true
51 else
52     # Configuration file is not tagged - skip question.
53     db_set mod-security-cn/rbl false || true
54     db_fset mod-security-cn/rbl seen true
55 fi
56
57 exit 0