Reviewed-on: #33 Co-authored-by: Davide Polonio <poloniodavide@gmail.com> Co-committed-by: Davide Polonio <poloniodavide@gmail.com>master
parent
85545c9a17
commit
54732efe29
|
@ -1,8 +1,6 @@
|
||||||
---
|
|
||||||
version: '3.9'
|
|
||||||
services:
|
services:
|
||||||
mail:
|
mail:
|
||||||
image: mailserver/docker-mailserver:13.3.1
|
image: mailserver/docker-mailserver:14.0.0
|
||||||
hostname: ${HOSTNAME}
|
hostname: ${HOSTNAME}
|
||||||
domainname: ${DOMAINNAME}
|
domainname: ${DOMAINNAME}
|
||||||
container_name: ${CONTAINER_NAME}
|
container_name: ${CONTAINER_NAME}
|
||||||
|
|
|
@ -27,8 +27,7 @@ RESET=$(echo -ne '\e[0m')
|
||||||
set -euEo pipefail
|
set -euEo pipefail
|
||||||
shopt -s inherit_errexit 2>/dev/null || true
|
shopt -s inherit_errexit 2>/dev/null || true
|
||||||
|
|
||||||
function _show_local_usage
|
function _show_local_usage() {
|
||||||
{
|
|
||||||
# shellcheck disable=SC2059
|
# shellcheck disable=SC2059
|
||||||
printf '%s' "${ORANGE}OPTIONS${RESET}
|
printf '%s' "${ORANGE}OPTIONS${RESET}
|
||||||
${LBLUE}Config path, container or image adjustments${RESET}
|
${LBLUE}Config path, container or image adjustments${RESET}
|
||||||
|
@ -69,8 +68,7 @@ function _show_local_usage
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _get_absolute_script_directory
|
function _get_absolute_script_directory() {
|
||||||
{
|
|
||||||
if dirname "$(readlink -f "${0}")" &>/dev/null; then
|
if dirname "$(readlink -f "${0}")" &>/dev/null; then
|
||||||
DIR=$(dirname "$(readlink -f "${0}")")
|
DIR=$(dirname "$(readlink -f "${0}")")
|
||||||
elif realpath -e -L "${0}" &>/dev/null; then
|
elif realpath -e -L "${0}" &>/dev/null; then
|
||||||
|
@ -79,8 +77,7 @@ function _get_absolute_script_directory
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _set_default_config_path
|
function _set_default_config_path() {
|
||||||
{
|
|
||||||
if [[ -d "${DIR}/config" ]]; then
|
if [[ -d "${DIR}/config" ]]; then
|
||||||
# legacy path (pre v10.2.0)
|
# legacy path (pre v10.2.0)
|
||||||
DEFAULT_CONFIG_PATH="${DIR}/config"
|
DEFAULT_CONFIG_PATH="${DIR}/config"
|
||||||
|
@ -89,8 +86,7 @@ function _set_default_config_path
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _handle_config_path
|
function _handle_config_path() {
|
||||||
{
|
|
||||||
if [[ -z ${DESIRED_CONFIG_PATH} ]]; then
|
if [[ -z ${DESIRED_CONFIG_PATH} ]]; then
|
||||||
# no desired config path
|
# no desired config path
|
||||||
if [[ -n ${CONTAINER_NAME} ]]; then
|
if [[ -n ${CONTAINER_NAME} ]]; then
|
||||||
|
@ -111,8 +107,7 @@ function _handle_config_path
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _run_in_new_container
|
function _run_in_new_container() {
|
||||||
{
|
|
||||||
# start temporary container with specified image
|
# start temporary container with specified image
|
||||||
if ! ${CRI} history -q "${IMAGE_NAME}" &>/dev/null; then
|
if ! ${CRI} history -q "${IMAGE_NAME}" &>/dev/null; then
|
||||||
echo "Image '${IMAGE_NAME}' not found. Pulling ..."
|
echo "Image '${IMAGE_NAME}' not found. Pulling ..."
|
||||||
|
@ -124,14 +119,12 @@ function _run_in_new_container
|
||||||
"${IMAGE_NAME}" "${@}"
|
"${IMAGE_NAME}" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _main
|
function _main() {
|
||||||
{
|
|
||||||
_get_absolute_script_directory
|
_get_absolute_script_directory
|
||||||
_set_default_config_path
|
_set_default_config_path
|
||||||
|
|
||||||
local OPTIND
|
local OPTIND
|
||||||
while getopts ":c:i:p:zZR" OPT
|
while getopts ":c:i:p:zZR" OPT; do
|
||||||
do
|
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
( i ) IMAGE_NAME="${OPTARG}" ;;
|
( i ) IMAGE_NAME="${OPTARG}" ;;
|
||||||
( z | Z ) USE_SELINUX=":${OPT}" ;;
|
( z | Z ) USE_SELINUX=":${OPT}" ;;
|
||||||
|
|
Loading…
Reference in New Issue