Modifications : etc/sv/dovecot
[lhc/ateliers.git] / etc / sv / dovecot / local.sh
1 "$tool"/local/apt-get-install dovecot-imapd dovecot-lmtpd dovecot-managesieved dovecot-pop3d dovecot-sieve
2 "$tool"/local/insserv-remove dovecot
3
4 hint="run before: remote/runit-configure $sv"
5 for domain in \
6 "$local_domainname" \
7 cyclocoop.org \
8 ptitvelo.net
9 do
10 for protocol in imap pop
11 do
12 assert "sudo test -f /etc/dovecot/$domain/"$protocol"/x509/key.pem" hint
13 sudo install -m 400 -o root -g root \
14 "$tool"/var/pub/x509/"$protocol"."$domain"/crt+crl.self-signed.pem \
15 /etc/dovecot/"$domain"/"$protocol"/x509/crt+crl.self-signed.pem
16 done
17 done
18
19 hint="run before: local/runit-configure nginx -- autoconfig"
20 assert "getent passwd www-autoconfig" hint
21 sudo install -d -m 750 -o www-autoconfig -g www-autoconfig \
22 ~www-autoconfig/mail/
23 sudo install -m 640 -o www-autoconfig -g www-autoconfig \
24 "$tool"/etc/dovecot/autoconfig.xml \
25 ~www-autoconfig/mail/config-v1.1.xml
26
27 sudo usermod --home /home/mail mail
28 sudo install -d -m 0751 -o mail -g mail \
29 ~mail
30 for dir in \
31 /etc/dovecot/acl/global.d \
32 ~mail/data \
33 ~mail/log \
34 /etc/dovecot/pop3 \
35 /etc/dovecot/pop3/INBOX \
36 /etc/dovecot/sieve \
37 /etc/dovecot/sieve/after.d \
38 /etc/dovecot/sieve/before.d \
39 /etc/dovecot/sieve/global.d
40 do
41 sudo install -d -m 3775 -o root -g root "$dir"
42 done
43 for dir in \
44 after.d \
45 before.d \
46 global.d
47 do
48 if sudo test -e "$tool"/etc/dovecot/sieve/"$dir"
49 then
50 sudo find "$tool"/etc/dovecot/sieve/"$dir" \
51 -maxdepth 1 -type f \
52 -name '*.sieve' \
53 -exec install -m 644 -o root -g root \
54 -t /etc/dovecot/sieve/"$dir" {} +
55 fi
56 sudo sievec /etc/dovecot/sieve/"$dir"
57 sudo find /etc/dovecot/sieve/"$dir" \
58 -maxdepth 1 -type f \
59 -exec chmod 664 {} +
60 done
61
62 #sudo install -d -m 770 -o root -g root \
63 # /etc/skel/etc/mail \
64 # /etc/skel/etc/sieve
65 sudo install -d -m 1777 -o root -g root \
66 /var/lib/dovecot-control \
67 /var/lib/dovecot-index
68 m4 \
69 --define=LOCAL_DOMAINNAME=$local_domainname \
70 <"$tool"/etc/dovecot/dovecot.conf.m4 |
71 sudo install -m 644 -o root -g root /dev/stdin \
72 /etc/dovecot/dovecot.conf
73 sudo install -m 640 -o root -g postfix \
74 "$tool"/etc/dovecot/transport \
75 /etc/dovecot/transport
76 sudo install -m 644 -o root -g root \
77 "$tool"/etc/dovecot/pop3/INBOX/dovecot-virtual \
78 /etc/dovecot/pop3/INBOX/dovecot-virtual
79 sudo postmap hash:/etc/dovecot/transport