summaryrefslogtreecommitdiffstats
path: root/content/opt/davmail/entrypoint.sh
blob: 7b3b518cbd26d5248eec06a12925b1b420850fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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