Modifications : etc/sv/postfix/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/pop3 \
34 /etc/dovecot/pop3/INBOX \
35 /etc/dovecot/sieve \
36 /etc/dovecot/sieve/after.d \
37 /etc/dovecot/sieve/before.d \
38 /etc/dovecot/sieve/global.d
39 do
40 sudo install -d -m 3775 -o root -g root "$dir"
41 done
42 for dir in \
43 after.d \
44 before.d \
45 global.d
46 do
47 if sudo test -e "$tool"/etc/dovecot/sieve/"$dir"
48 then
49 sudo find "$tool"/etc/dovecot/sieve/"$dir" \
50 -maxdepth 1 -type f \
51 -name '*.sieve' \
52 -exec install -m 644 -o root -g root \
53 -t /etc/dovecot/sieve/"$dir" {} +
54 fi
55 sudo sievec /etc/dovecot/sieve/"$dir"
56 sudo find /etc/dovecot/sieve/"$dir" \
57 -maxdepth 1 -type f \
58 -exec chmod 664 {} +
59 done
60
61 #sudo install -d -m 770 -o root -g root \
62 # /etc/skel/etc/mail \
63 # /etc/skel/etc/sieve
64 sudo install -d -m 1777 -o root -g root \
65 /var/lib/dovecot-control \
66 /var/lib/dovecot-index
67 m4 \
68 --define=LOCAL_DOMAINNAME=$local_domainname \
69 <"$tool"/etc/dovecot/dovecot.conf.m4 |
70 sudo install -m 644 -o root -g root /dev/stdin \
71 /etc/dovecot/dovecot.conf
72 sudo install -m 640 -o root -g postfix \
73 "$tool"/etc/dovecot/transport \
74 /etc/dovecot/transport
75 sudo install -m 644 -o root -g root \
76 "$tool"/etc/dovecot/pop3/INBOX/dovecot-virtual \
77 /etc/dovecot/pop3/INBOX/dovecot-virtual
78 sudo postmap hash:/etc/dovecot/transport