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