build files for making podman containers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

44 lines
1.2 KiB

#!/bin/sh
### Domains ###
# /vol/data/domains should contain the configuration parameters for myhostname and virtual_alias_domains
cat /vol/data/domains /etc/postfix/main.cf.part > /etc/postfix/main.cf
### Users ###
# copy users db to dovecot config
cp /vol/data/users /etc/dovecot/users
chown dovecot:dovecot /etc/dovecot/users
# copy users db to postfix config, but without passwords
cat /vol/data/users | cut -d':' -f1 | perl -pe 's/(.*)/\1 ./' > /etc/postfix/users
postmap /etc/postfix/users
### Aliases ###
# copy aliases to postfix config
cd /etc/postfix
cat /vol/data/aliases.d/*.list > aliases
postmap aliases
# copy blacklist to postfix config
cat /vol/data/aliases.d/*.deny > deny
postmap deny
### Reload ###
postfix reload
dovecot reload
### Sieve ###
# copy users sieve to mail
cd /vol/data/sieve.d
for user in * ; do
mkdir -p /vol/mail/${user}
chown vmail:vmail /vol/mail/${user} ${user}
echo "Testing ${user}'s sieve script for compilation errors..."
sievec ${user} -d - > /dev/null
if [ $? -eq 0 ]; then
echo "No errors detected."
cp -p ${user} /vol/mail/${user}/.dovecot.sieve
else
echo "Compilation errors detected in ${user}'s sieve script. Please correct any errors and run $(basename $0) again."
fi
done