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