From fe1526cc972ed1ede80b81d912979be5ef2a8baa Mon Sep 17 00:00:00 2001 From: polpetta Date: Thu, 3 Feb 2022 21:43:17 +0000 Subject: [PATCH] feat: bump mailserver to 10.4.0 (#11) Co-authored-by: Davide Polonio Reviewed-on: https://git.poldebra.me/polpetta/server-dotfiles/pulls/11 Co-authored-by: polpetta Co-committed-by: polpetta --- mail/docker-compose.yml | 4 ++-- mail/setup.sh | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/mail/docker-compose.yml b/mail/docker-compose.yml index 2668c6d..ed37fb4 100644 --- a/mail/docker-compose.yml +++ b/mail/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.7' services: mail: - image: mailserver/docker-mailserver:10.2.0 + image: mailserver/docker-mailserver:10.4.0 hostname: ${HOSTNAME} domainname: ${DOMAINNAME} container_name: ${CONTAINER_NAME} @@ -39,7 +39,7 @@ services: - internal roundcube: - image: roundcube/roundcubemail:1.4.11-apache + image: roundcube/roundcubemail:1.4.12-apache restart: always depends_on: - mail diff --git a/mail/setup.sh b/mail/setup.sh index 100ecc4..8dd22b4 100755 --- a/mail/setup.sh +++ b/mail/setup.sh @@ -12,6 +12,7 @@ DESIRED_CONFIG_PATH= DIR="$(pwd)" DMS_CONFIG='/tmp/docker-mailserver' IMAGE_NAME= +DEFAULT_IMAGE_NAME='docker.io/mailserver/docker-mailserver:latest' INFO= PODMAN_ROOTLESS=false USE_SELINUX= @@ -25,6 +26,7 @@ LBLUE="\e[94m" RESET="\e[0m" set -euEo pipefail +shopt -s inherit_errexit trap '__err "${BASH_SOURCE}" "${FUNCNAME[0]:-?}" "${BASH_COMMAND:-?}" "${LINENO:-?}" "${?:-?}"' ERR function __err @@ -49,7 +51,7 @@ function _show_local_usage ${LBLUE}Config path, container or image adjustments${RESET} -i IMAGE_NAME Provides the name of the 'docker-mailserver' image. The default value is - '${WHITE}docker.io/mailserver/docker-mailserver:latest${RESET}' + '${WHITE}${DEFAULT_IMAGE_NAME}${RESET}' -c CONTAINER_NAME Provides the name of the running container. @@ -102,8 +104,17 @@ function _get_absolute_script_directory DIR="$(realpath -e -L "${0}")" DIR="${DIR%/setup.sh}" fi +} - DEFAULT_CONFIG_PATH="${DIR}/config" +function _set_default_config_path +{ + if [[ -d "${DIR}/config" ]] + then + # legacy path (pre v10.2.0) + DEFAULT_CONFIG_PATH="${DIR}/config" + else + DEFAULT_CONFIG_PATH="${DIR}/docker-data/dms/config" + fi } function _handle_config_path @@ -149,6 +160,7 @@ function _run_in_new_container function _main { _get_absolute_script_directory + _set_default_config_path local OPTIND while getopts ":c:i:p:zZR" OPT @@ -205,7 +217,7 @@ function _main [[ -z ${IMAGE_NAME} ]] && IMAGE_NAME=${INFO%;*} if [[ -z ${IMAGE_NAME} ]] then - IMAGE_NAME=${NAME:-docker.io/mailserver/docker-mailserver:latest} + IMAGE_NAME=${NAME:-${DEFAULT_IMAGE_NAME}} fi if test -t 0