mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 06:14:14 +00:00
paper: download default configs before patching (#3004)
This commit is contained in:
parent
0ff8e68f01
commit
d7c6a7d2b6
4 changed files with 29 additions and 0 deletions
|
@ -52,6 +52,12 @@ else
|
|||
|
||||
fi
|
||||
|
||||
# Download default configs to allow for consistent patching
|
||||
for c in paper-global.yml paper-world-defaults.yml spigot.yml; do
|
||||
DOWNLOAD_DEFAULT_CONFIGS+=",${PAPER_CONFIG_DEFAULTS_REPO}/${VERSION}/$c"
|
||||
done
|
||||
export DOWNLOAD_DEFAULT_CONFIGS
|
||||
|
||||
# Normalize on Spigot for downstream operations
|
||||
export FAMILY=SPIGOT
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ patchLog4jConfig() {
|
|||
canUseRollingLogs=false
|
||||
}
|
||||
|
||||
# Temporarily disable debugging output
|
||||
oldState=$(shopt -po xtrace || true)
|
||||
shopt -u -o xtrace
|
||||
# Patch Log4j remote code execution vulnerability
|
||||
# See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition
|
||||
if versionLessThan 1.7; then
|
||||
|
@ -80,6 +83,7 @@ elif isType PURPUR && versionLessThan 1.18.1; then
|
|||
elif versionLessThan 1.18.1; then
|
||||
useFallbackJvmFlag=true
|
||||
fi
|
||||
eval "$oldState"
|
||||
|
||||
if ${useFallbackJvmFlag}; then
|
||||
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
. "${SCRIPTS:-/}start-utils"
|
||||
|
||||
set -e
|
||||
handleDebugMode
|
||||
|
||||
: "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}"
|
||||
: "${REPLACE_ENV_PATHS:=/data}"
|
||||
|
@ -13,6 +14,7 @@ set -e
|
|||
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
|
||||
: "${PATCH_DEFINITIONS:=}"
|
||||
: "${DEBUG:=false}"
|
||||
: "${DOWNLOAD_DEFAULT_CONFIGS:=}"
|
||||
|
||||
if isTrue "${REPLACE_ENV_IN_PLACE}"; then
|
||||
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix '$REPLACE_ENV_VARIABLE_PREFIX' ..."
|
||||
|
@ -25,6 +27,16 @@ if isTrue "${REPLACE_ENV_IN_PLACE}"; then
|
|||
"${REPLACE_ENV_PATHS[@]}"
|
||||
fi
|
||||
|
||||
if [[ $DOWNLOAD_DEFAULT_CONFIGS ]]; then
|
||||
log "Downloading default configs, if needed"
|
||||
if ! mc-image-helper mcopy \
|
||||
--to /data/config \
|
||||
--skip-existing --skip-up-to-date=false \
|
||||
"$DOWNLOAD_DEFAULT_CONFIGS" 2> /dev/null; then
|
||||
log "WARN: one or more default config files were not available from $DOWNLOAD_DEFAULT_CONFIGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${PATCH_DEFINITIONS} ]]; then
|
||||
log "Applying patch definitions from ${PATCH_DEFINITIONS}"
|
||||
mc-image-helper patch \
|
||||
|
|
|
@ -265,10 +265,17 @@ function compare_version() {
|
|||
}
|
||||
|
||||
function versionLessThan() {
|
||||
local oldState
|
||||
# The return status when listing options is zero if all optnames are enabled, non- zero otherwise.
|
||||
oldState=$(shopt -po xtrace || true)
|
||||
shopt -u -o xtrace
|
||||
|
||||
# Use if-else since strict mode might be enabled
|
||||
if compare_version "${VERSION}" "lt" "${1?}"; then
|
||||
eval "$oldState"
|
||||
return 0
|
||||
else
|
||||
eval "$oldState"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue