diff --git a/.github/workflows/build-multiarch.yml b/.github/workflows/build-multiarch.yml index 8c6626e5..4e5d35f8 100644 --- a/.github/workflows/build-multiarch.yml +++ b/.github/workflows/build-multiarch.yml @@ -68,7 +68,7 @@ jobs: load: true push: false cache-from: type=gha - cache-to: type=gha,mode=max + # no cache-to to avoid cross-cache update from next build step - name: Run tests # It is assumed that image variants are merged from master and tested there diff --git a/Dockerfile b/Dockerfile index 485efcae..a57873a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,7 +60,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \ --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz -ARG MC_HELPER_VERSION=1.9.10 +ARG MC_HELPER_VERSION=1.10.0 ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/v${MC_HELPER_VERSION} RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \ | tar -C /usr/share -zxf - \ diff --git a/scripts/start-deployAirplane b/scripts/start-deployAirplane index 4feb298b..1fde1263 100755 --- a/scripts/start-deployAirplane +++ b/scripts/start-deployAirplane @@ -47,6 +47,7 @@ fi # Normalize on Spigot for later operations export TYPE=SPIGOT +export FAMILY=SPIGOT export SKIP_LOG4J_CONFIG=true exec ${SCRIPTS:-/}start-spiget "$@" diff --git a/scripts/start-deployBukkitSpigot b/scripts/start-deployBukkitSpigot index 03779dc8..120da778 100755 --- a/scripts/start-deployBukkitSpigot +++ b/scripts/start-deployBukkitSpigot @@ -127,6 +127,7 @@ fi # Normalize on Spigot for operations below export TYPE=SPIGOT +export FAMILY=SPIGOT export SKIP_LOG4J_CONFIG=true exec ${SCRIPTS:-/}start-spiget "$@" diff --git a/scripts/start-deployCF b/scripts/start-deployCF index cdbafb30..c00c1dcf 100755 --- a/scripts/start-deployCF +++ b/scripts/start-deployCF @@ -233,4 +233,5 @@ elif [ -e "${FTB_DIR}/Install.sh" ]; then popd fi +export FAMILY=FORGE exec "${SCRIPTS:-/}start-setupWorld" "$@" diff --git a/scripts/start-deployCanyon b/scripts/start-deployCanyon index a9ed0302..0aa17331 100755 --- a/scripts/start-deployCanyon +++ b/scripts/start-deployCanyon @@ -44,6 +44,7 @@ fi # Normalize on Spigot for later operations export TYPE=SPIGOT +export FAMILY=SPIGOT export SKIP_LOG4J_CONFIG=true exec ${SCRIPTS:-/}start-spiget "$@" diff --git a/scripts/start-deployCatserver b/scripts/start-deployCatserver index 32ad7d72..88fef2b9 100755 --- a/scripts/start-deployCatserver +++ b/scripts/start-deployCatserver @@ -28,5 +28,6 @@ fi export SKIP_LOG4J_CONFIG=true +export FAMILY=HYBRID # Continue to Final Setup exec ${SCRIPTS:-/}start-setupWorld "$@" diff --git a/scripts/start-deployCrucible b/scripts/start-deployCrucible index d204664c..606600c3 100755 --- a/scripts/start-deployCrucible +++ b/scripts/start-deployCrucible @@ -56,5 +56,6 @@ fi export SERVER export SKIP_LOG4J_CONFIG=true +export FAMILY=HYBRID exec "${SCRIPTS:-$(dirname "$0")}/start-setupWorld" "$@" diff --git a/scripts/start-deployCustom b/scripts/start-deployCustom index a51e7c72..c4a92570 100755 --- a/scripts/start-deployCustom +++ b/scripts/start-deployCustom @@ -31,5 +31,5 @@ else fi export SKIP_LOG4J_CONFIG=true - +export FAMILY=HYBRID exec ${SCRIPTS:-/}start-setupWorld $@ diff --git a/scripts/start-deployFTBA b/scripts/start-deployFTBA index 0e1d3463..fc3962f5 100755 --- a/scripts/start-deployFTBA +++ b/scripts/start-deployFTBA @@ -79,4 +79,5 @@ if ! [ -v SERVER ]; then exit 2 fi +export FAMILY=FORGE exec ${SCRIPTS:-/}start-setupWorld $@ diff --git a/scripts/start-deployFabric b/scripts/start-deployFabric index 4f0a0d79..228bdeae 100755 --- a/scripts/start-deployFabric +++ b/scripts/start-deployFabric @@ -69,4 +69,5 @@ if [[ ! -e ${SERVER} ]]; then mv fabric-server-launch.jar "${SERVER}" fi +export FAMILY=FABRIC exec ${SCRIPTS:-/}start-setupWorld "$@" diff --git a/scripts/start-deployForge b/scripts/start-deployForge index 85386713..8111c295 100755 --- a/scripts/start-deployForge +++ b/scripts/start-deployForge @@ -147,4 +147,5 @@ else fi fi +export FAMILY=FORGE exec "${SCRIPTS:-/}start-setupWorld" "$@" diff --git a/scripts/start-deployLimbo b/scripts/start-deployLimbo index 3c4e086f..ad19457c 100755 --- a/scripts/start-deployLimbo +++ b/scripts/start-deployLimbo @@ -60,4 +60,5 @@ export LEVEL export SKIP_LOG4J_CONFIG=true +export FAMILY=LIMBO exec ${SCRIPTS:-/}start-setupWorld $@ diff --git a/scripts/start-deployMagma b/scripts/start-deployMagma index bf54a1e4..fb92c684 100755 --- a/scripts/start-deployMagma +++ b/scripts/start-deployMagma @@ -89,4 +89,5 @@ else fi fi -exec ${SCRIPTS:-/}start-setupWorld $@ +export FAMILY=HYBRID +exec ${SCRIPTS:-/}start-setupWorld "$@" diff --git a/scripts/start-deployMohist b/scripts/start-deployMohist index 1b8338fa..e17b4d57 100755 --- a/scripts/start-deployMohist +++ b/scripts/start-deployMohist @@ -40,4 +40,5 @@ fi export SKIP_LOG4J_CONFIG=true +export FAMILY=HYBRID exec "${SCRIPTS:-$(dirname "$0")}/start-setupWorld" "$@" diff --git a/scripts/start-deployPaper b/scripts/start-deployPaper index e221eb58..69406b3c 100755 --- a/scripts/start-deployPaper +++ b/scripts/start-deployPaper @@ -74,6 +74,7 @@ fi # Normalize on Spigot for downstream operations export TYPE=SPIGOT +export FAMILY=SPIGOT export SKIP_LOG4J_CONFIG=true exec ${SCRIPTS:-/}start-spiget "$@" diff --git a/scripts/start-deployPurpur b/scripts/start-deployPurpur index cc1233f5..e8b38424 100755 --- a/scripts/start-deployPurpur +++ b/scripts/start-deployPurpur @@ -32,6 +32,7 @@ fi # Normalize on Spigot for later operations export TYPE=SPIGOT +export FAMILY=SPIGOT export SKIP_LOG4J_CONFIG=true exec ${SCRIPTS:-/}start-spiget "$@" diff --git a/scripts/start-deploySpongeVanilla b/scripts/start-deploySpongeVanilla index b296e7f3..d6a0ec39 100755 --- a/scripts/start-deploySpongeVanilla +++ b/scripts/start-deploySpongeVanilla @@ -37,4 +37,5 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then curl -sSL -o $SERVER https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER fi -exec ${SCRIPTS:-/}start-setupWorld $@ +export FAMILY=SPONGE +exec ${SCRIPTS:-/}start-setupWorld "$@" diff --git a/scripts/start-deployVanilla b/scripts/start-deployVanilla index 291f0f64..fd2474bc 100755 --- a/scripts/start-deployVanilla +++ b/scripts/start-deployVanilla @@ -52,5 +52,5 @@ elif [[ -L /data/minecraft_server.jar ]]; then fi isDebugging && ls -l - +export FAMILY=VANILLA exec "${SCRIPTS:-/}start-setupWorld" "$@" diff --git a/scripts/start-finalExec b/scripts/start-finalExec index 939c700f..78603ebc 100755 --- a/scripts/start-finalExec +++ b/scripts/start-finalExec @@ -96,10 +96,9 @@ patchLog4jConfig() { } # Patch Log4j remote code execution vulnerability -# NOTE: Paper, bukkit, and spigot are normalized to SPIGOT -if [[ ${TYPE^^} != SPIGOT ]] && versionLessThan 1.12; then +if isFamily VANILLA && versionLessThan 1.12; then patchLog4jConfig log4j2_17-111.xml https://launcher.mojang.com/v1/objects/dd2b723346a8dcd48e7f4d245f6bf09e98db9696/log4j2_17-111.xml -elif [[ ${TYPE^^} != SPIGOT ]] && versionLessThan 1.17; then +elif isFamily VANILLA && versionLessThan 1.17; then patchLog4jConfig log4j2_112-116.xml https://launcher.mojang.com/v1/objects/02937d122c86ce73319ef9975b58896fc1b491d1/log4j2_112-116.xml elif versionLessThan 1.18.1; then JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}" diff --git a/scripts/start-utils b/scripts/start-utils index 21e57379..1a2ed977 100755 --- a/scripts/start-utils +++ b/scripts/start-utils @@ -112,34 +112,7 @@ function normalizeMemSize() { } function versionLessThan() { - local activeParts - version=${VANILLA_VERSION%%-*} # for snapshot/rc versions - version=${version##b} # for versions like b1.7.3 - IFS=. read -ra activeParts <<<"${version}" - - local givenParts - IFS=. read -ra givenParts <<<"$1" - - if ((${#activeParts[@]} < 2)); then - return 1 - fi - - if ((${#activeParts[@]} == 2)); then - if ((activeParts[0] < givenParts[0])) || - ((activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1])); then - return 0 - else - return 1 - fi - else - if ((activeParts[0] < givenParts[0])) || - ((activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1])) || - ((activeParts[0] == givenParts[0] && activeParts[1] == givenParts[1] && activeParts[2] < givenParts[2])); then - return 0 - else - return 1 - fi - fi + mc-image-helper compare-versions "${VANILLA_VERSION}" lt "${1?}" } requireVar() { @@ -163,7 +136,7 @@ requireEnum() { fi done - log "ERROR: $var must be set to one of $@" + log "ERROR: $var must be set to one of $*" # exit 1 } @@ -189,4 +162,13 @@ function get() { flags+=("--debug") fi mc-image-helper "${flags[@]}" get "$@" +} + +function isFamily() { + for f in "${@}"; do + if [[ $FAMILY == "$f" ]]; then + return 0 + fi + done + return 1 } \ No newline at end of file