diff --git a/Dockerfile b/Dockerfile index 228a03e6..e9c33f62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,7 +61,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.16.3 +ARG MC_HELPER_VERSION=1.16.5 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/README.md b/README.md index a26aa52f..cfb32691 100644 --- a/README.md +++ b/README.md @@ -747,9 +747,9 @@ You may also download or copy over individual mods using the `MODS` environment docker run -d -e MODS=https://www.example.com/mods/mod1.jar,/plugins/common,/plugins/special/mod2.jar ... -### **ForgeAPI** usage to use non-version specific projects +### ForgeAPI usage to use non-version specific projects -**NOTE:** This potentially could lead to unexpected behavior if the Mod recieves an update with unexpected behavior. +**NOTE:** This potentially could lead to unexpected behavior if the Mod receives an update with unexpected behavior. This is more complicated because you will be pulling/using the latest mod for the release of your game. To get started make sure you have a [CursedForge API Key](https://docs.curseforge.com/#getting-started). Then use the environmental parameters in your docker build. @@ -775,10 +775,10 @@ Example of expected forge api project ids, releases, and key: Example of expected ForgeAPI file format. **Field Description**: -* Name is currently unused, but can be used to document each entry. -* Project id is the id found on the CurseForge website for a particular mod -* Release Type corresponds to forge's R, B, A icon for each file. Default Release, options are (release|beta|alpha). -* FileName is used for version pinning if latest file will not work for you. +* `name` is currently unused, but can be used to document each entry. +* `projectId` id is the id found on the CurseForge website for a particular mod +* `releaseType` Type corresponds to forge's R, B, A icon for each file. Default Release, options are (release|beta|alpha). +* `fileName` is used for version pinning if latest file will not work for you. ```json [ @@ -803,7 +803,7 @@ Example of expected ForgeAPI file format. ### Generic pack files -To install all of the server content (jars, mods, plugins, configs, etc) from a zip or tgz file, such as a CurseForge modpack that is missing a server start script, then set `GENERIC_PACK` to the container path or URL of the archive file. +To install all the server content (jars, mods, plugins, configs, etc.) from a zip or tgz file, then set `GENERIC_PACK` to the container path or URL of the archive file. This can also be used to apply a CurseForge modpack that is missing a server start script and/or Forge installer. If multiple generic packs need to be applied together, set `GENERIC_PACKS` instead, with a comma separated list of archive file paths and/or URLs to files. @@ -817,6 +817,8 @@ GENERIC_PACKS_SUFFIX=.zip would expand to `https://cdn.example.org/configs-v9.0.1.zip,https://cdn.example.org/mods-v4.3.6.zip`. +If applying large generic packs, the update check can be time-consuming since a SHA1 checksum is compared. To skip the update check set `SKIP_GENERIC_PACK_UPDATE_CHECK` to "true". Conversely, the generic pack(s) can be forced to be applied without comparing the checksum by setting `FORCE_GENERIC_PACK_UPDATE` to "true". + ### Mod/Plugin URL Listing File As an alternative to `MODS`, the variable `MODS_FILE` can be set with the path to a text file listing a mod/plugin URL on each line. For example, the following diff --git a/scripts/start-setupModpack b/scripts/start-setupModpack index 88281d4a..cc421780 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -29,7 +29,7 @@ if [[ "${PACKWIZ_URL}" ]]; then if [[ -z "${latestPackwiz}" ]]; then log "WARNING: Could not retrieve Packwiz bootstrap installer release information" else - isDebugging && log "Latest packwiz ${latestPackWiz}" + isDebugging && log "Latest packwiz ${latestPackwiz}" latestPackwizVer=$(echo ${latestPackwiz} | jq --raw-output '.tag_name') latestPackwizUrl=$(echo ${latestPackwiz} | jq --raw-output '.assets[] | select(.name | match("packwiz-installer-bootstrap.jar")) | .url') : "${PACKWIZ_JAR:=packwiz-installer-bootstrap_${latestPackwizVer}.jar}" @@ -199,6 +199,7 @@ if [[ "${GENERIC_PACKS}" ]]; then pack="${GENERIC_PACKS_PREFIX}${packEntry}${GENERIC_PACKS_SUFFIX}" if isURL "${pack}"; then mkdir -p /data/packs + log "Downloading generic pack from $pack" if ! outfile=$(get -o /data/packs --output-filename --skip-existing "$pack"); then log "ERROR: failed to download $pack" exit 2 @@ -210,7 +211,13 @@ if [[ "${GENERIC_PACKS}" ]]; then done isDebugging && [ -f "$sum_file}" ] && cat "$sum_file" - if ! sha1sum -c "${sum_file}" --status 2> /dev/null; then + + log "Checking if generic packs are up to date" + if isTrue "${SKIP_GENERIC_PACK_UPDATE_CHECK:-false}" && [ -f "$sum_file" ]; then + log "Skipping generic pack update check" + elif isTrue "${FORCE_GENERIC_PACK_UPDATE}" || ! sha1sum -c "${sum_file}" --status 2> /dev/null; then + log "Generic pack(s) are out of date. Re-applying..." + base_dir=/tmp/generic_pack_base mkdir -p ${base_dir} for pack in "${packFiles[@]}"; do @@ -243,6 +250,7 @@ if [[ "${GENERIC_PACKS}" ]]; then cp -R -f "${base_dir}"/* /data rm -rf /tmp/generic_pack_base + log "Saving generic pack(s) checksum" sha1sum "${packFiles[@]}" > "${sum_file}" isDebugging && cat "$sum_file" fi diff --git a/tests/setuponlytests/generic-packs/docker-compose.yml b/tests/setuponlytests/generic-packs/docker-compose.yml index b5450605..a2b27c5d 100644 --- a/tests/setuponlytests/generic-packs/docker-compose.yml +++ b/tests/setuponlytests/generic-packs/docker-compose.yml @@ -11,8 +11,14 @@ services: image: ${IMAGE_TO_TEST:-itzg/minecraft-server} environment: EULA: "true" - SETUP_ONLY: "TRUE" + SETUP_ONLY: "true" GENERIC_PACKS: http://web/configs.zip,/packs/testing.zip + LOG_TIMESTAMP: "true" + # the following are only used to speed up test execution + TYPE: CUSTOM + CUSTOM_SERVER: /servers/fake.jar + VERSION: 1.18.1 volumes: - ./packs:/packs - ./data:/data + - ./fake.jar:/servers/fake.jar diff --git a/tests/setuponlytests/generic-packs/fake.jar b/tests/setuponlytests/generic-packs/fake.jar new file mode 100644 index 00000000..e69de29b