From e320c546fddf0dae3e23ab609871ddac692ca8dc Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Thu, 13 Apr 2023 19:10:33 +0000 Subject: [PATCH] Print php exception when snappymail fails to generate data directory and config file on the very first time --- .docker/release/files/entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.docker/release/files/entrypoint.sh b/.docker/release/files/entrypoint.sh index de93abf81..25194fa71 100755 --- a/.docker/release/files/entrypoint.sh +++ b/.docker/release/files/entrypoint.sh @@ -33,8 +33,14 @@ find /var/lib/snappymail/ -type d -exec chmod 750 {} \; SNAPPYMAIL_CONFIG_FILE=/var/lib/snappymail/_data_/_default_/configs/application.ini if [ ! -f "$SNAPPYMAIL_CONFIG_FILE" ]; then echo "[INFO] Creating default Snappymail configuration: $SNAPPYMAIL_CONFIG_FILE" - # Run snappymail and exit. This populates the snappymail data directory - su - www-data -s /bin/sh -c 'php /snappymail/index.php' > /dev/null + # Run snappymail and exit. This populates the snappymail data directory and generates the config file + # On error, print php exception and exit + EXITCODE= + su - www-data -s /bin/sh -c 'php /snappymail/index.php' > /tmp/out || EXITCODE=$? + if [ -n "$EXITCODE" ]; then + cat /tmp/out + exit "$EXITCODE" + fi fi echo "[INFO] Overriding values in snappymail configuration: $SNAPPYMAIL_CONFIG_FILE"