@@ -6,7 +6,7 @@ export CHATMAIL_INI="${CHATMAIL_INI:-/etc/chatmail/chatmail.ini}"
66CMDEPLOY=/opt/cmdeploy/bin/cmdeploy
77
88if [ -z " $MAIL_DOMAIN " ]; then
9- echo " ERROR: Environment variable 'MAIL_DOMAIN' must be set!" >&2
9+ echo " [ ERROR] Environment variable 'MAIL_DOMAIN' must be set!" >&2
1010 exit 1
1111fi
1212
@@ -16,6 +16,7 @@ if [ ! -f /etc/dkimkeys/opendkim.private ]; then
1616fi
1717# Fix ownership for bind-mounted keys (host opendkim UID may differ from container)
1818chown -R opendkim:opendkim /etc/dkimkeys
19+ echo " [INFO] Fixing /etc/dkimkeys ownership"
1920
2021# Create chatmail.ini, skip if mounted
2122mkdir -p " $( dirname " $CHATMAIL_INI " ) "
4546mkdir -p " /home/vmail/mail/${MAIL_DOMAIN} "
4647chown vmail:vmail " /home/vmail/mail/${MAIL_DOMAIN} "
4748
49+ # Fix ownership for bind-mounted mail store (host vmail UID may differ from container).
50+ # Only recurse when the top-level dir is mis-owned, can be slow on large mailstores.
51+ if [ " $( stat -c %U /home/vmail 2> /dev/null) " != " vmail" ]; then
52+ echo " [INFO] Fixing /home/vmail ownership"
53+ chown -R vmail:vmail /home/vmail
54+ fi
55+
4856# --- Deploy fingerprint: skip cmdeploy run if nothing changed ---
4957# On restart with identical image+config, systemd already brings up all
5058# enabled services only configure+activate are needed here.
0 commit comments