added config-path option to setup.sh script (Closes: #698)
* added config-path option to setup.sh script
This commit is contained in:
parent
5394a505b9
commit
21b7cf72c9
28
setup.sh
28
setup.sh
|
@ -11,6 +11,7 @@ INFO=$(docker ps \
|
||||||
|
|
||||||
IMAGE_NAME=$(echo $INFO | awk '{print $1}')
|
IMAGE_NAME=$(echo $INFO | awk '{print $1}')
|
||||||
CONTAINER_NAME=$(echo $INFO | awk '{print $2}')
|
CONTAINER_NAME=$(echo $INFO | awk '{print $2}')
|
||||||
|
CONFIG_PATH="$(pwd)/config"
|
||||||
|
|
||||||
if [ -z "$IMAGE_NAME" ]; then
|
if [ -z "$IMAGE_NAME" ]; then
|
||||||
IMAGE_NAME=tvial/docker-mailserver:latest
|
IMAGE_NAME=tvial/docker-mailserver:latest
|
||||||
|
@ -38,6 +39,8 @@ OPTIONS:
|
||||||
'tvial/docker-mailserver:latest'.
|
'tvial/docker-mailserver:latest'.
|
||||||
-c CONTAINER_NAME The name of the running container.
|
-c CONTAINER_NAME The name of the running container.
|
||||||
|
|
||||||
|
-p PATH config folder path (default: $(pwd)/config)
|
||||||
|
|
||||||
SUBCOMMANDS:
|
SUBCOMMANDS:
|
||||||
|
|
||||||
email:
|
email:
|
||||||
|
@ -61,7 +64,7 @@ SUBCOMMANDS:
|
||||||
debug:
|
debug:
|
||||||
|
|
||||||
$0 debug fetchmail
|
$0 debug fetchmail
|
||||||
$0 debug fail2ban [<unban> <ip-address>]
|
$0 debug fail2ban [<unban> <ip-address>]
|
||||||
$0 debug show-mail-logs
|
$0 debug show-mail-logs
|
||||||
$0 debug inspect
|
$0 debug inspect
|
||||||
$0 debug login <commands>
|
$0 debug login <commands>
|
||||||
|
@ -84,7 +87,7 @@ _docker_image() {
|
||||||
fi
|
fi
|
||||||
docker run \
|
docker run \
|
||||||
--rm \
|
--rm \
|
||||||
-v "$(pwd)/config":/tmp/docker-mailserver \
|
-v "$CONFIG_PATH":/tmp/docker-mailserver \
|
||||||
-ti "$IMAGE_NAME" $@
|
-ti "$IMAGE_NAME" $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +100,7 @@ _docker_container() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":c:i:" OPT; do
|
while getopts ":c:i:p:" OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
c)
|
c)
|
||||||
CONTAINER_NAME="$OPTARG"
|
CONTAINER_NAME="$OPTARG"
|
||||||
|
@ -105,6 +108,21 @@ while getopts ":c:i:" OPT; do
|
||||||
i)
|
i)
|
||||||
IMAGE_NAME="$OPTARG"
|
IMAGE_NAME="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
p)
|
||||||
|
case "$OPTARG" in
|
||||||
|
/*)
|
||||||
|
CONFIG_PATH="$OPTARG"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CONFIG_PATH="$(pwd)/$OPTARG"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ ! -d "$CONFIG_PATH" ]; then
|
||||||
|
echo "Directory doesn't exist"
|
||||||
|
_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -$OPTARG" >&2
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
;;
|
;;
|
||||||
|
@ -133,7 +151,7 @@ case $1 in
|
||||||
restrict)
|
restrict)
|
||||||
shift
|
shift
|
||||||
_docker_image restrict-access $@
|
_docker_image restrict-access $@
|
||||||
;;
|
;;
|
||||||
list)
|
list)
|
||||||
_docker_image listmailuser
|
_docker_image listmailuser
|
||||||
;;
|
;;
|
||||||
|
@ -211,7 +229,7 @@ case $1 in
|
||||||
case "$RESULT" in
|
case "$RESULT" in
|
||||||
*"is not banned"*) ;;
|
*"is not banned"*) ;;
|
||||||
*"NOK"*) ;;
|
*"NOK"*) ;;
|
||||||
*) echo -n "unbanned IP from $JAIL: "
|
*) echo -n "unbanned IP from $JAIL: "
|
||||||
echo "$RESULT";;
|
echo "$RESULT";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue