coreos-home-server/config/service/dovecot/container/run-dovecot
Alex Palaistras d9f675817e First public release for CoreOS Home Server
This contains the culmination of work done privately for a few months,
and is intended to be a solid basis for other peoples' experimentations
with setting up single-node, home-server setups using Fedora CoreOS.
2021-03-20 16:32:42 +00:00

24 lines
836 B
Bash
Executable File

#!/bin/sh
# Prepare configuration files for environment variable substitution.
ENV_NAMES="`env | awk -F '=' '{printf "$%s ", $1}'`"
for file in /etc/dovecot/*.template; do
envsubst "$ENV_NAMES" < "$file" > "`echo $file | awk -F '.template$' '{print $1}'`"
done
# Prepare other configuration.
mkdir -p /var/lib/dovecot/script /var/lib/dovecot/sieve
install -m 0755 /etc/dovecot/conf.d/*.script /var/lib/dovecot/script
install -m 0644 /etc/dovecot/conf.d/*.sieve /var/lib/dovecot/sieve
# Compile Sieve scripts.
find /etc/dovecot/sieve.* -name '*.sieve' | xargs -I@ sievec @
find /var/lib/dovecot/sieve -name '*.sieve' | xargs -I@ sievec @
# Set up environment variables for Rspamd.
mkdir -p /etc/dovecot/rspamd
env | awk -F '_' '$1 == "RSPAMD" {print $0}' > /etc/dovecot/rspamd/rspamd.env
# Run Dovecot daemon.
/usr/sbin/dovecot -F