5a13ee8e4ecb175daa9bb8efb8f5bb681f334998
[dovecot-cn.git] / debian / postinst
1 #!/bin/sh -e
2
3 [ "$1" = "configure" ] || exit 0
4 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
5
6 # Load CARNet Tools
7 . /usr/share/carnet-tools/functions.sh
8
9 cp_check_and_sed '^protocols' \
10                  's/protocols.*$/protocols = imap imaps pop3 pop3s/g' \
11                  /etc/dovecot/dovecot.conf || true
12
13 cp_check_and_sed '#disable_plaintext_auth' \
14                  's/#disable_plaintext_auth/disable_plaintext_auth/g' \
15                  /etc/dovecot/dovecot.conf || true
16
17 cp_check_and_sed 'disable_plaintext_auth.*yes' \
18                  's/disable_plaintext_auth.*$/disable_plaintext_auth = no/g' \
19                  /etc/dovecot/dovecot.conf || true
20
21 cp_check_and_sed '#imap_client_workarounds' \
22                  's/#imap_client_workarounds/imap_client_workarounds/g' \
23                  /etc/dovecot/dovecot.conf || true
24
25 cp_check_and_sed '#pop3_client_workarounds' \
26                  's/#pop3_client_workarounds/pop3_client_workarounds/g' \
27                  /etc/dovecot/dovecot.conf || true
28
29 cp_check_and_sed 'imap_client_workarounds' \
30                  's/imap_client_workarounds.*$/imap_client_workarounds = outlook-idle tb-extra-mailbox-sep netscape-eoh delay-newmail/g' \
31                  /etc/dovecot/dovecot.conf || true
32
33 cp_check_and_sed 'pop3_client_workarounds' \
34                  's/pop3_client_workarounds.*$/pop3_client_workarounds = outlook-no-nuls oe-ns-eoh/g' \
35                  /etc/dovecot/dovecot.conf || true
36
37 cp_check_and_sed 'pop3_uidl_format' \
38                  's/pop3_uidl_format.*$/pop3_uidl_format = %v.%u/g' \
39                  /etc/dovecot/dovecot.conf || true
40
41 cp_check_and_sed '#quota = maildir' \
42                  's/#quota = maildir/quota = fs/g' \
43                  /etc/dovecot/dovecot.conf || true
44
45 # dodano zbog backward compatibility (etch->lenny)
46 cp_check_and_sed '^mail_extra_groups' \
47                  's/^mail_extra_groups/mail_privileged_group/g' \
48                  /etc/dovecot/dovecot.conf || true
49
50 cp_check_and_sed '#ssl_cipher_list' \
51                  's/#ssl_cipher_list.*/ssl_cipher_list = ALL:!aNULL:!eNULL:!ADH!LOW:!MEDIUM:!EXP:!SSLv2:HIGH/g' \
52                  /etc/dovecot/dovecot.conf || true
53
54 # ovo je potrebno postaviti u verziji 1.2
55 cp_check_and_sed '#mail_location' \
56                  's|#mail_location.*|mail_location=mbox:~/mail:INBOX=/var/mail/%u|g' \
57                  /etc/dovecot/dovecot.conf || true
58
59 # trazio zelja
60 cp_check_and_sed '#ssl =' \
61                  's/^#ssl =/ssl =/g' \
62                  /etc/dovecot/dovecot.conf || true
63
64 if grep -q "^ssl_disable .*no" /etc/dovecot/dovecot.conf; then
65   cp_check_and_sed '^ssl =' \
66                    's/^ssl =.*/ssl = yes/g' \
67                    /etc/dovecot/dovecot.conf || true
68 elif grep -q "^ssl_disable .*yes" /etc/dovecot/dovecot.conf; then
69   cp_check_and_sed '^ssl =' \
70                    's/^ssl =.*/ssl = no/g' \
71                    /etc/dovecot/dovecot.conf || true
72 fi
73
74 cp_check_and_sed '^ssl_disable' \
75                  's/^ssl_disable/#ssl_disable/g' \
76                  /etc/dovecot/dovecot.conf || true
77
78
79 # restart 
80 if [ -x /usr/sbin/invoke-rc.d ]; then
81   [ -x /etc/init.d/dovecot ] && invoke-rc.d dovecot restart
82 else
83   [ -x /etc/init.d/dovecot ] && /etc/init.d/dovecot restart
84 fi
85
86 #DEBHELPER#
87
88 exit 0