summaryrefslogtreecommitdiffstats
path: root/content/opt/davmail
diff options
context:
space:
mode:
Diffstat (limited to 'content/opt/davmail')
-rwxr-xr-xcontent/opt/davmail/entrypoint.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/content/opt/davmail/entrypoint.sh b/content/opt/davmail/entrypoint.sh
new file mode 100755
index 0000000..7b3b518
--- /dev/null
+++ b/content/opt/davmail/entrypoint.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -el
+
+[ -z "$*" ] || exec "$@"
+
+CONFIG=${1:-/etc/davmail/davmail.properties}
+if [ -n "$DAVMAIL_CONFIG_URL" ]; then
+ CONFIG=$HOME/davmail.properties
+ wget -qO $CONFIG "$DAVMAIL_CONFIG_URL"
+elif [ -n "$DAVMAIL_URL" ]; then
+ CONFIG=$HOME/davmail.properties
+ while read line; do
+ eval echo "$line"
+ done < /etc/davmail/davmail.properties.template > $CONFIG
+fi
+
+if [ -r "$CONFIG" ]; then
+ exec /opt/davmail/davmail.sh "$CONFIG"
+else
+ echo "ERROR: can't read [$CONFIG]!"
+ return 1
+fi