2021-01-13 16:36:50 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Prepare configuration files for environment variable substitution.
|
2021-11-13 13:12:24 +00:00
|
|
|
ENV_NAMES="$(env | awk -F= '{printf "$%s ", $1}')"
|
2021-01-13 16:36:50 +00:00
|
|
|
for file in /etc/dovecot/*.template; do
|
2021-11-13 13:12:24 +00:00
|
|
|
envsubst "$ENV_NAMES" < "$file" > "$(echo "$file" | awk -F '.template$' '{print $1}')"
|
2021-01-13 16:36:50 +00:00
|
|
|
done
|
|
|
|
|
2021-11-13 13:24:15 +00:00
|
|
|
# Compile Sieve scripts and ensure correct permissions.
|
2021-11-13 13:12:24 +00:00
|
|
|
find /etc/dovecot -name '*.sieve' -execdir sievec {} \;
|
2021-11-13 13:24:15 +00:00
|
|
|
find /etc/dovecot -name '*.script' -execdir chmod 0755 {} \;
|
2021-01-13 16:36:50 +00:00
|
|
|
|
2021-11-13 13:12:24 +00:00
|
|
|
# Set up environment variables for Rspamd integration.
|
|
|
|
env | awk -F_ '$1 == "RSPAMD" {print $0}' > /etc/dovecot/rspamd.env
|
2021-01-13 16:36:50 +00:00
|
|
|
|
|
|
|
# Run Dovecot daemon.
|
|
|
|
/usr/sbin/dovecot -F
|