2021-01-13 16:36:50 +00:00
|
|
|
#!/bin/sh
|
2024-01-02 15:31:49 +00:00
|
|
|
set -eu
|
2021-01-13 16:36:50 +00:00
|
|
|
|
|
|
|
# Prepare configuration files for environment variable substitution.
|
2024-01-02 15:31:49 +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
|
2024-01-02 15:31:49 +00:00
|
|
|
envsubst "$ENV_NAMES" < "$file" > "${file%.template}"
|
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.
|
2024-01-02 15:31:49 +00:00
|
|
|
env | awk -F '_' '$1 == "RSPAMD" {print $0}' > /etc/dovecot/rspamd.env
|
2021-01-13 16:36:50 +00:00
|
|
|
|
|
|
|
# Run Dovecot daemon.
|
2024-01-02 15:31:49 +00:00
|
|
|
exec /usr/sbin/dovecot -F
|