mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-30 18:57:15 +00:00
paper: download default configs before patching (#3004)
This commit is contained in:
@@ -52,6 +52,12 @@ else
|
|||||||
|
|
||||||
fi
|
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
|
# Normalize on Spigot for downstream operations
|
||||||
export FAMILY=SPIGOT
|
export FAMILY=SPIGOT
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ patchLog4jConfig() {
|
|||||||
canUseRollingLogs=false
|
canUseRollingLogs=false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Temporarily disable debugging output
|
||||||
|
oldState=$(shopt -po xtrace || true)
|
||||||
|
shopt -u -o xtrace
|
||||||
# Patch Log4j remote code execution vulnerability
|
# Patch Log4j remote code execution vulnerability
|
||||||
# See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition
|
# See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition
|
||||||
if versionLessThan 1.7; then
|
if versionLessThan 1.7; then
|
||||||
@@ -80,6 +83,7 @@ elif isType PURPUR && versionLessThan 1.18.1; then
|
|||||||
elif versionLessThan 1.18.1; then
|
elif versionLessThan 1.18.1; then
|
||||||
useFallbackJvmFlag=true
|
useFallbackJvmFlag=true
|
||||||
fi
|
fi
|
||||||
|
eval "$oldState"
|
||||||
|
|
||||||
if ${useFallbackJvmFlag}; then
|
if ${useFallbackJvmFlag}; then
|
||||||
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
|
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
. "${SCRIPTS:-/}start-utils"
|
. "${SCRIPTS:-/}start-utils"
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
handleDebugMode
|
||||||
|
|
||||||
: "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}"
|
: "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}"
|
||||||
: "${REPLACE_ENV_PATHS:=/data}"
|
: "${REPLACE_ENV_PATHS:=/data}"
|
||||||
@@ -13,6 +14,7 @@ set -e
|
|||||||
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
|
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
|
||||||
: "${PATCH_DEFINITIONS:=}"
|
: "${PATCH_DEFINITIONS:=}"
|
||||||
: "${DEBUG:=false}"
|
: "${DEBUG:=false}"
|
||||||
|
: "${DOWNLOAD_DEFAULT_CONFIGS:=}"
|
||||||
|
|
||||||
if isTrue "${REPLACE_ENV_IN_PLACE}"; then
|
if isTrue "${REPLACE_ENV_IN_PLACE}"; then
|
||||||
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix '$REPLACE_ENV_VARIABLE_PREFIX' ..."
|
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[@]}"
|
"${REPLACE_ENV_PATHS[@]}"
|
||||||
fi
|
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
|
if [[ ${PATCH_DEFINITIONS} ]]; then
|
||||||
log "Applying patch definitions from ${PATCH_DEFINITIONS}"
|
log "Applying patch definitions from ${PATCH_DEFINITIONS}"
|
||||||
mc-image-helper patch \
|
mc-image-helper patch \
|
||||||
|
|||||||
@@ -265,10 +265,17 @@ function compare_version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function versionLessThan() {
|
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
|
# Use if-else since strict mode might be enabled
|
||||||
if compare_version "${VERSION}" "lt" "${1?}"; then
|
if compare_version "${VERSION}" "lt" "${1?}"; then
|
||||||
|
eval "$oldState"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
eval "$oldState"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user