2021-09-16 02:27:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-01-17 02:49:15 +00:00
|
|
|
# shellcheck source=start-utils
|
|
|
|
. "${SCRIPTS:-/}start-utils"
|
2021-09-16 02:27:48 +00:00
|
|
|
|
2022-01-17 02:49:15 +00:00
|
|
|
: "${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}"
|
2021-09-16 02:27:48 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
if [ -d /plugins ]; then
|
2022-01-17 02:49:15 +00:00
|
|
|
case ${FAMILY} in
|
|
|
|
SPIGOT|HYBRID)
|
2021-09-16 02:27:48 +00:00
|
|
|
mkdir -p /data/plugins
|
|
|
|
log "Copying plugins over..."
|
|
|
|
mc-image-helper \
|
|
|
|
--debug=${DEBUG} ${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} \
|
|
|
|
/plugins /data/plugins
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If any modules have been provided, copy them over
|
2022-01-17 02:49:15 +00:00
|
|
|
: "${COPY_MODS_DEST:="/data/mods"}"
|
2021-09-16 02:27:48 +00:00
|
|
|
|
|
|
|
if [ -d /mods ]; then
|
|
|
|
log "Copying any mods over..."
|
|
|
|
mc-image-helper \
|
|
|
|
--debug=${DEBUG} ${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} \
|
|
|
|
/mods "${COPY_MODS_DEST}"
|
|
|
|
fi
|
|
|
|
|
2022-01-17 02:49:15 +00:00
|
|
|
: "${COPY_CONFIG_DEST:="/data/config"}"
|
2021-09-16 02:27:48 +00:00
|
|
|
|
|
|
|
if [ -d /config ]; then
|
|
|
|
log "Copying any configs from /config to ${COPY_CONFIG_DEST}"
|
|
|
|
mc-image-helper \
|
|
|
|
--debug=${DEBUG} ${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} \
|
|
|
|
/config "${COPY_CONFIG_DEST}"
|
|
|
|
fi
|
|
|
|
|
2022-01-17 02:49:15 +00:00
|
|
|
exec "${SCRIPTS:-/}start-setupServerProperties" "$@"
|