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