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