From fcf719625cc6428bb8e01855c35e095f3d93ef3d Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Sat, 31 Aug 2024 15:09:15 +0000 Subject: [PATCH] Create the var directory before trying to chown. During cold start, var directory may not exist and we try to chown the var directory which fails if it doesn't exist. We want to make and chown the var directory in that case otherwise, mailman will not be able to write to path `/opt/mailman` to create it's own var directory. --- core/docker-entrypoint.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/docker-entrypoint.sh b/core/docker-entrypoint.sh index 9ac8fbe..519ad2f 100755 --- a/core/docker-entrypoint.sh +++ b/core/docker-entrypoint.sh @@ -247,7 +247,17 @@ echo "HYPERKITTY_API_KEY not defined, skipping HyperKitty setup..." fi # Now chown the places where mailman wants to write stuff. -chown -R mailman /opt/mailman/var +VAR_DIR="/opt/mailman/var" +# Check if the directory exists +if [ ! -d "$VAR_DIR" ]; then + # Directory does not exist, so create it + mkdir -p "$VAR_DIR" + echo "Directory $VAR_DIR created." +else + echo "Directory $VAR_DIR already exists." +fi + +chown -R mailman $VAR_DIR # Generate the LMTP files for postfix if needed. su-exec mailman mailman aliases