Commit d7c6a7d 1 parent 0ff8e68 commit d7c6a7d Copy full SHA for d7c6a7d
File tree 4 files changed +29
-0
lines changed
4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 52
52
53
53
fi
54
54
55
+ # Download default configs to allow for consistent patching
56
+ for c in paper-global.yml paper-world-defaults.yml spigot.yml; do
57
+ DOWNLOAD_DEFAULT_CONFIGS+=" ,${PAPER_CONFIG_DEFAULTS_REPO} /${VERSION} /$c "
58
+ done
59
+ export DOWNLOAD_DEFAULT_CONFIGS
60
+
55
61
# Normalize on Spigot for downstream operations
56
62
export FAMILY=SPIGOT
57
63
Original file line number Diff line number Diff line change @@ -64,6 +64,9 @@ patchLog4jConfig() {
64
64
canUseRollingLogs=false
65
65
}
66
66
67
+ # Temporarily disable debugging output
68
+ oldState=$( shopt -po xtrace || true)
69
+ shopt -u -o xtrace
67
70
# Patch Log4j remote code execution vulnerability
68
71
# See https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition
69
72
if versionLessThan 1.7; then
@@ -80,6 +83,7 @@ elif isType PURPUR && versionLessThan 1.18.1; then
80
83
elif versionLessThan 1.18.1; then
81
84
useFallbackJvmFlag=true
82
85
fi
86
+ eval " $oldState "
83
87
84
88
if ${useFallbackJvmFlag} ; then
85
89
JVM_OPTS=" -Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS} "
Original file line number Diff line number Diff line change 4
4
. " ${SCRIPTS:-/ } start-utils"
5
5
6
6
set -e
7
+ handleDebugMode
7
8
8
9
: " ${REPLACE_ENV_IN_PLACE:= ${REPLACE_ENV_VARIABLES:- false} } "
9
10
: " ${REPLACE_ENV_PATHS:=/ data} "
13
14
: " ${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:= } "
14
15
: " ${PATCH_DEFINITIONS:= } "
15
16
: " ${DEBUG:= false} "
17
+ : " ${DOWNLOAD_DEFAULT_CONFIGS:= } "
16
18
17
19
if isTrue " ${REPLACE_ENV_IN_PLACE} " ; then
18
20
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
25
27
" ${REPLACE_ENV_PATHS[@]} "
26
28
fi
27
29
30
+ if [[ $DOWNLOAD_DEFAULT_CONFIGS ]]; then
31
+ log " Downloading default configs, if needed"
32
+ if ! mc-image-helper mcopy \
33
+ --to /data/config \
34
+ --skip-existing --skip-up-to-date=false \
35
+ " $DOWNLOAD_DEFAULT_CONFIGS " 2> /dev/null; then
36
+ log " WARN: one or more default config files were not available from $DOWNLOAD_DEFAULT_CONFIGS "
37
+ fi
38
+ fi
39
+
28
40
if [[ ${PATCH_DEFINITIONS} ]]; then
29
41
log " Applying patch definitions from ${PATCH_DEFINITIONS} "
30
42
mc-image-helper patch \
Original file line number Diff line number Diff line change @@ -265,10 +265,17 @@ function compare_version() {
265
265
}
266
266
267
267
function versionLessThan() {
268
+ local oldState
269
+ # The return status when listing options is zero if all optnames are enabled, non- zero otherwise.
270
+ oldState=$( shopt -po xtrace || true)
271
+ shopt -u -o xtrace
272
+
268
273
# Use if-else since strict mode might be enabled
269
274
if compare_version " ${VERSION} " " lt" " ${1?} " ; then
275
+ eval " $oldState "
270
276
return 0
271
277
else
278
+ eval " $oldState "
272
279
return 1
273
280
fi
274
281
}
You can’t perform that action at this time.
0 commit comments