mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-13 23:57:08 +00:00
75 lines
2.5 KiB
Bash
Executable file
75 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# shellcheck source=start-utils
|
|
. "${SCRIPTS:-/}start-utils"
|
|
|
|
: "${SYNC_SKIP_NEWER_IN_DESTINATION:=${PLUGINS_SYNC_UPDATE:-true}}"
|
|
: "${REPLACE_ENV_DURING_SYNC:=true}"
|
|
: "${REPLACE_ENV_SUFFIXES:=yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml}"
|
|
: "${REPLACE_ENV_VARIABLE_PREFIX:=${ENV_VARIABLE_PREFIX:-CFG_}}"
|
|
: "${REPLACE_ENV_VARIABLES_EXCLUDES:=}"
|
|
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
|
|
: "${DEBUG:=false}"
|
|
|
|
set -e
|
|
isDebugging && set -x
|
|
|
|
if isTrue "${SYNC_SKIP_NEWER_IN_DESTINATION}"; then
|
|
updateArg="--skip-newer-in-destination"
|
|
fi
|
|
|
|
if isTrue "${REPLACE_ENV_DURING_SYNC}"; then
|
|
subcommand=sync-and-interpolate
|
|
else
|
|
subcommand=sync
|
|
fi
|
|
|
|
: "${COPY_PLUGINS_SRC:="/plugins"}"
|
|
: "${COPY_PLUGINS_DEST:="/data/plugins"}"
|
|
|
|
if [ -d "${COPY_PLUGINS_SRC}" ]; then
|
|
case ${FAMILY} in
|
|
SPIGOT|HYBRID)
|
|
mkdir -p "${COPY_PLUGINS_DEST}"
|
|
log "Copying any plugins from ${COPY_PLUGINS_SRC} to ${COPY_PLUGINS_DEST}"
|
|
mc-image-helper \
|
|
${subcommand} $updateArg \
|
|
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
|
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
|
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
|
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
|
"${COPY_PLUGINS_SRC}" "${COPY_PLUGINS_DEST}"
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# If any modules have been provided, copy them over
|
|
: "${COPY_MODS_SRC:="/mods"}"
|
|
: "${COPY_MODS_DEST:="/data/mods"}"
|
|
|
|
if [ -d "${COPY_MODS_SRC}" ]; then
|
|
log "Copying any mods from ${COPY_MODS_SRC} to ${COPY_MODS_DEST}"
|
|
mc-image-helper \
|
|
${subcommand} $updateArg \
|
|
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
|
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
|
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
|
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
|
"${COPY_MODS_SRC}" "${COPY_MODS_DEST}"
|
|
fi
|
|
|
|
: "${COPY_CONFIG_SRC:="/config"}"
|
|
: "${COPY_CONFIG_DEST:="/data/config"}"
|
|
|
|
if [ -d "${COPY_CONFIG_SRC}" ]; then
|
|
log "Copying any configs from ${COPY_CONFIG_SRC} to ${COPY_CONFIG_DEST}"
|
|
mc-image-helper \
|
|
${subcommand} $updateArg \
|
|
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \
|
|
--replace-env-excludes="${REPLACE_ENV_VARIABLES_EXCLUDES}" \
|
|
--replace-env-exclude-paths="${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}" \
|
|
--replace-env-prefix="${REPLACE_ENV_VARIABLE_PREFIX}" \
|
|
"${COPY_CONFIG_SRC}" "${COPY_CONFIG_DEST}"
|
|
fi
|
|
|
|
exec "${SCRIPTS:-/}start-setupServerProperties" "$@"
|