From 3e3abda71e0a9f2bb7edf6d3026dbdebd39289f8 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 22 May 2022 11:35:52 -0500 Subject: [PATCH] Constrain GENERIC_PACK base detection depth (#1528) --- examples/docker-compose-rlcraft.yml | 20 +++++++++---------- scripts/start-deployForge | 4 ++-- scripts/start-finalExec | 4 ++-- scripts/start-setupModpack | 12 ++++++----- .../vanilla-latest/docker-compose.yml | 2 +- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/examples/docker-compose-rlcraft.yml b/examples/docker-compose-rlcraft.yml index 0bda0d9a..dd0eeab7 100644 --- a/examples/docker-compose-rlcraft.yml +++ b/examples/docker-compose-rlcraft.yml @@ -1,27 +1,27 @@ version: '3.8' services: - rlcraft: + mc: image: itzg/minecraft-server:java8 - container_name: rlcraft volumes: - - rlcraft-modpack:/modpacks:ro - - rlcraft-data:/data + - data:/data + - ./modpacks:/modpacks:ro environment: EULA: "true" TYPE: "FORGE" VERSION: "1.12.2" - FORGEVERSION: "14.23.5.2855" + FORGEVERSION: "14.23.5.2860" + OVERRIDE_SERVER_PROPERTIES: "true" DIFFICULTY: "hard" MAX_TICK_TIME: "-1" - VIEW_DISTANCE: "6" ALLOW_FLIGHT: "true" + ENABLE_COMMAND_BLOCK: "true" + VIEW_DISTANCE: "10" MEMORY: "4G" - GENERIC_PACK: "/modpacks/RLCraft_Server_Pack_1.12.2_Beta_v2.8.2.zip" + # Download from https://www.curseforge.com/minecraft/modpacks/rlcraft and place in modpacks subdir + GENERIC_PACK: "/modpacks/RLCraft+Server+Pack+1.12.2+-+Release+v2.9.1c.zip" ports: - 25565:25565 - restart: unless-stopped volumes: - rlcraft-data: - rlcraft-modpack: + data: diff --git a/scripts/start-deployForge b/scripts/start-deployForge index abd9e840..4ef67f56 100755 --- a/scripts/start-deployForge +++ b/scripts/start-deployForge @@ -8,7 +8,7 @@ isDebugging && set -x get_installer() { if [[ -z $FORGE_INSTALLER_URL ]]; then - log "Downloading $normForgeVersion" + log "Downloading Forge Installer $normForgeVersion" forgeFileNames=" $shortForgeVersion/forge-$shortForgeVersion-installer.jar @@ -25,7 +25,7 @@ get_installer() { log "Unable to locate usable URL for $normForgeVersion" exit 2 else - log "Downloading $FORGE_INSTALLER_URL ..." + log "Downloading Forge Installer from $FORGE_INSTALLER_URL ..." if ! get -o "$FORGE_INSTALLER" "$FORGE_INSTALLER_URL"; then log "Failed to download from given location $FORGE_INSTALLER_URL" exit 2 diff --git a/scripts/start-finalExec b/scripts/start-finalExec index 98148748..e354b468 100755 --- a/scripts/start-finalExec +++ b/scripts/start-finalExec @@ -122,8 +122,8 @@ if [ -n "$JVM_DD_OPTS" ]; then done fi -if isTrue ${ENABLE_JMX}; then - : ${JMX_PORT:=7091} +if isTrue "${ENABLE_JMX}"; then + : "${JMX_PORT:=7091}" JVM_OPTS="${JVM_OPTS} -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.port=${JMX_PORT} diff --git a/scripts/start-setupModpack b/scripts/start-setupModpack index cc236198..77c22edf 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -216,18 +216,20 @@ if [[ "${GENERIC_PACKS}" ]]; then elif isTrue "${FORCE_GENERIC_PACK_UPDATE}" || ! checkSum "${sum_file}"; then log "Generic pack(s) are out of date. Re-applying..." - base_dir=/tmp/generic_pack_base - mkdir -p ${base_dir} + original_base_dir=/data/.tmp/generic_pack_base + base_dir=$original_base_dir + rm -rf "${base_dir}" + mkdir -p "${base_dir}" for pack in "${packFiles[@]}"; do isDebugging && ls -l "${pack}" extract "${pack}" "${base_dir}" done # recalculate the actual base directory of content - base_dir=$(find "$base_dir" -type d \( -name mods -o -name plugins -o -name config \) -printf '%h' -quit) + base_dir=$(find "$base_dir" -maxdepth 3 -type d \( -name mods -o -name plugins -o -name config \) -printf '%h' -quit) if [[ ! $base_dir ]]; then log "ERROR: Unable to find content base of generic packs ${GENERIC_PACKS}. Directories:" - find /tmp/generic_pack_base -type d -printf ' - %P\n' + find $original_base_dir -maxdepth 3 -type d -printf ' - %P\n' exit 1 fi @@ -246,7 +248,7 @@ if [[ "${GENERIC_PACKS}" ]]; then log "Applying generic pack ..." cp -R -f "${base_dir}"/* /data - rm -rf /tmp/generic_pack_base + rm -rf $original_base_dir log "Saving generic pack(s) checksum" sha1sum "${packFiles[@]}" > "${sum_file}" diff --git a/tests/fulltests/vanilla-latest/docker-compose.yml b/tests/fulltests/vanilla-latest/docker-compose.yml index 61c6f289..8065459d 100644 --- a/tests/fulltests/vanilla-latest/docker-compose.yml +++ b/tests/fulltests/vanilla-latest/docker-compose.yml @@ -5,7 +5,7 @@ services: depends_on: - mc image: itzg/mc-monitor:${MC_MONITOR_VERSION:-0.10.4} - command: status --host mc --retry-interval 1s --timeout 1s --retry-limit 240 + command: status --host mc --retry-interval 1s --timeout 1s --retry-limit 300 mc: restart: "no" image: ${IMAGE_TO_TEST:-itzg/minecraft-server}