forked from vshalts/docker-emailrelay
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·29 lines (26 loc) · 1.05 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
set -e
# Some (hopefully) sensible defaults. Users don't have to specify those.
DEFAULT_OPTS=${DEFAULT_OPTS:---no-daemon --no-syslog --log --remote-clients --port "${PORT:-587}"}
# Running this image without any command-line argument doesn't make sense
if [ -z "$*" ]; then
echo "FATAL: Please provide some command-line arguments to emailrelay"
echo "E.g., -D msa.example.com --immediate --forward-to mail.example.org:smtp"
echo "Note, we already pass ${DEFAULT_OPTS}"
exit 2
fi
case "$*" in
-h\ *|--help\ *|-V|--version)
# A request for help or version are special cases.
exec /usr/sbin/emailrelay $@ ;;
-*)
# If the arguments (CMD, assuming we're an ENTRYPOINT) starts
# with a minus-dash, it's the options to emailrelay.
# Prefill some defaults (so we don't have to specify them),
# then run.
exec /usr/sbin/emailrelay $DEFAULT_OPTS $@ ;;
*)
# If arguments don't start with a minus-dash, let's assume
# it's a proper shell command to execute and do so.
exec "$@" ;;
esac