From c8df2d8e31ad43c8304ce9ba2e69c586d288f861 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 23 Oct 2021 10:20:19 -0500 Subject: [PATCH 1/4] docs: Noted SELinux scenario for volume host directory mount #390 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0d1a1bae..ed56a6f2 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,8 @@ services: - ./minecraft-data:/data ``` +> NOTE: if you have SELinux enabled, then you might need to add `:Z` to the end of volume mount specifications, [as described here](https://prefetch.net/blog/2017/09/30/using-docker-volumes-on-selinux-enabled-servers/). + ### Converting anonymous `/data` volume to named volume If you had used the commands in the first section, without the `-v` volume attachment, then an anonymous data volume was created by Docker. You can later bring over that content to a named or host attached volume using the following procedure. From 6f80ce55844f55b57ccbef336f5e65b7c563047c Mon Sep 17 00:00:00 2001 From: itzg Date: Sat, 23 Oct 2021 15:20:34 +0000 Subject: [PATCH 2/4] docs: Auto update markdown TOC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed56a6f2..69e573cb 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Enabling Autopause](#enabling-autopause) * [Running on RaspberryPi](#running-on-raspberrypi) - + From 2dce24c1bdff793e3239aa08da450e8fb75e1655 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 24 Oct 2021 20:23:21 -0500 Subject: [PATCH 3/4] Added support for multiple files with GENERIC_PACKS #1087 --- README.md | 2 + scripts/start-setupModpack | 41 +++++++++++++------- tests/generic-packs/docker-compose.test.yml | 15 +++++++ tests/generic-packs/packs/testing.zip | Bin 0 -> 212 bytes 4 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 tests/generic-packs/docker-compose.test.yml create mode 100644 tests/generic-packs/packs/testing.zip diff --git a/README.md b/README.md index 69e573cb..a4f745bc 100644 --- a/README.md +++ b/README.md @@ -721,6 +721,8 @@ You may also download or copy over individual mods using the `MODS` environment To install all of the server content (jars, mods, plugins, configs, etc) from a zip file, such as a CurseForge modpack that is missing a server start script, then set `GENERIC_PACK` to the container path of the zip file. That, combined with `TYPE`, allows for custom content along with container managed server download and install. +If multiple generic packs need to be applied together, set `GENERIC_PACKS` instead, with a comma separated list of zip file paths and/or URLs to zip files. + ### 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 3d4f13be..18605299 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -8,7 +8,7 @@ set -e -o pipefail : "${REMOVE_OLD_MODS_INCLUDE:=*.jar}" # shellcheck source=start-utils -. "${SCRIPTS:-$(dirname "$0")}/start-utils" +. "${SCRIPTS:-/}start-utils" isDebugging && set -x # CURSE_URL_BASE used in manifest downloads below @@ -158,28 +158,40 @@ case "X$EFFECTIVE_MANIFEST_FILE" in esac fi -if [[ "${GENERIC_PACK}" ]]; then - if isURL "${GENERIC_PACK}"; then - log "Downloading generic pack ..." - if ! curl -fsSL -o /tmp/generic_pack.zip "${GENERIC_PACK}"; then - log "ERROR: failed to download ${GENERIC_PACK}" - exit 2 +: "${GENERIC_PACKS:=${GENERIC_PACK}}" + +if [[ "${GENERIC_PACKS}" ]]; then + IFS=',' read -ra packs <<< "${GENERIC_PACKS}" + + packFiles=() + for pack in "${packs[@]}"; do + if isURL "$pack"; then + mkdir -p /data/packs + if ! outfile=$(get -o /data/packs --output-filename --skip-existing "$pack"); then + log "ERROR: failed to download $pack" + exit 2 + fi + packFiles+=("$outfile") + else + packFiles+=("$pack") fi - GENERIC_PACK=/tmp/generic_pack.zip - fi + done sum_file=/data/.generic_pack.sum isDebugging && [ -f "$sum_file}" ] && cat "$sum_file" if ! sha256sum -c "${sum_file}" --status 2> /dev/null; then base_dir=/tmp/generic_pack_base mkdir -p ${base_dir} - isDebugging && ls -l "${GENERIC_PACK}" - unzip -q -d ${base_dir} "${GENERIC_PACK}" + for pack in "${packFiles[@]}"; do + isDebugging && ls -l "${pack}" + unzip -q -d ${base_dir} "${pack}" + 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) if [[ ! $base_dir ]]; then - log "Unable to find content base of generic pack ${GENERIC_PACK}" + log "ERROR: Unable to find content base of generic packs ${GENERIC_PACKS}. Directories:" + find /tmp/generic_pack_base -type d -printf ' - %P\n' exit 1 fi @@ -199,9 +211,10 @@ if [[ "${GENERIC_PACK}" ]]; then log "Applying generic pack ..." cp -R -f "${base_dir}"/* /data rm -rf /tmp/generic_pack_base - sha256sum "${GENERIC_PACK}" > "${sum_file}" + + sha256sum "${packFiles[@]}" > "${sum_file}" isDebugging && cat "$sum_file" fi fi -exec "${SCRIPTS:-$(dirname "$0")}/start-setupModconfig" "$@" +exec "${SCRIPTS:-/}start-setupModconfig" "$@" diff --git a/tests/generic-packs/docker-compose.test.yml b/tests/generic-packs/docker-compose.test.yml new file mode 100644 index 00000000..210c54dd --- /dev/null +++ b/tests/generic-packs/docker-compose.test.yml @@ -0,0 +1,15 @@ +version: "3" + +services: + mc: + image: itzg/minecraft-server + environment: + EULA: "true" + GENERIC_PACKS: https://github.com/itzg/mc-image-helper/releases/download/v1.9.5/mc-image-helper-1.9.5.zip,/packs/testing.zip + DEBUG: "true" + volumes: + - ./packs:/packs + - data:/data + +volumes: + data: {} \ No newline at end of file diff --git a/tests/generic-packs/packs/testing.zip b/tests/generic-packs/packs/testing.zip new file mode 100644 index 0000000000000000000000000000000000000000..3bab4151dc3e39c20c43ed93c720158acbb46935 GIT binary patch literal 212 zcmWIWW@Zs#00Hs&5y4;vlwb$a`FW{&B^4zBa7Bt}igO=z k2r*j$LLrPtXu@UzLX#?xiE14y8%UN32=jroKZwHs0QdwMxBvhE literal 0 HcmV?d00001 From 9c354d5775cb0c524c3b9f083473fc08a9d09f0b Mon Sep 17 00:00:00 2001 From: itzg Date: Mon, 25 Oct 2021 01:23:54 +0000 Subject: [PATCH 4/4] docs: Auto update markdown TOC --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4f745bc..f8c1e6c2 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ By default, the container will download the latest version of the "vanilla" [Min * [Enabling Autopause](#enabling-autopause) * [Running on RaspberryPi](#running-on-raspberrypi) - +