summaryrefslogtreecommitdiffstats
path: root/content/opt/davmail/entrypoint.sh
diff options
context:
space:
mode:
authorJames Z.M. Gao <gaozhm@mvad.com>2016-05-03 08:53:33 +0800
committerJames Z.M. Gao <gaozhm@mvad.com>2016-05-03 08:53:33 +0800
commit6ccdfc95c331f328ba71dfb5f6f36702f87338c6 (patch)
treee1b125754d5d3cb49149bb730f934d6d7cc4f417 /content/opt/davmail/entrypoint.sh
downloaddavmail-6ccdfc95c331f328ba71dfb5f6f36702f87338c6.tar.gz
davmail-6ccdfc95c331f328ba71dfb5f6f36702f87338c6.tar.bz2
davmail-6ccdfc95c331f328ba71dfb5f6f36702f87338c6.tar.xz
davmail-6ccdfc95c331f328ba71dfb5f6f36702f87338c6.zip
add Dockerfile
Diffstat (limited to 'content/opt/davmail/entrypoint.sh')
-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