2016-08-28 19:10:25 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
##
|
|
|
|
# Wrapper for various setup scripts included in the docker-mailserver
|
|
|
|
##
|
|
|
|
|
|
|
|
if [ -z "$DOCKER_IMAGE" ]; then
|
|
|
|
DOCKER_IMAGE=tvial/docker-mailserver:latest
|
|
|
|
fi
|
|
|
|
|
|
|
|
_usage() {
|
|
|
|
echo "Usage: $0 <subcommand> <subcommand> [args]
|
|
|
|
|
|
|
|
SUBCOMMANDS:
|
|
|
|
|
|
|
|
email:
|
|
|
|
|
|
|
|
$0 email add <email> <password>
|
|
|
|
$0 email del <email>
|
2016-08-29 11:44:36 +00:00
|
|
|
$0 email list
|
2016-08-28 19:10:25 +00:00
|
|
|
|
|
|
|
config:
|
|
|
|
|
|
|
|
$0 config dkim
|
|
|
|
$0 config ssl
|
|
|
|
|
|
|
|
debug:
|
|
|
|
|
2016-08-29 17:03:45 +00:00
|
|
|
$0 debug fetchmail
|
2016-08-28 19:10:25 +00:00
|
|
|
"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
_docker() {
|
|
|
|
docker run --rm \
|
|
|
|
-v "$(pwd)/config":/tmp/docker-mailserver \
|
|
|
|
-ti $DOCKER_IMAGE $@
|
|
|
|
}
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
|
|
|
|
email)
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
|
|
|
|
add)
|
|
|
|
shift
|
|
|
|
_docker addmailuser $@
|
|
|
|
;;
|
|
|
|
del)
|
|
|
|
shift
|
|
|
|
_docker delmailuser $@
|
|
|
|
;;
|
|
|
|
|
2016-08-29 11:44:36 +00:00
|
|
|
list)
|
|
|
|
_docker listmailuser
|
|
|
|
;;
|
2016-08-28 19:10:25 +00:00
|
|
|
|
|
|
|
*)
|
|
|
|
_usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
config)
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
dkim)
|
|
|
|
shift
|
|
|
|
_docker generate-dkim-config
|
|
|
|
;;
|
|
|
|
|
|
|
|
ssl)
|
|
|
|
shift
|
|
|
|
_docker generate-ssl-certificate
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
debug)
|
|
|
|
shift
|
|
|
|
case $1 in
|
|
|
|
fetchmail)
|
2016-08-29 17:03:45 +00:00
|
|
|
_docker debug-fetchmail
|
2016-08-28 19:10:25 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
_usage
|
|
|
|
;;
|
|
|
|
esac
|