From d8cd6f3f381a81a50817a388c11d096523fdbae4 Mon Sep 17 00:00:00 2001 From: Geoff Bourne <988985+itzg@users.noreply.github.com> Date: Wed, 14 Oct 2026 20:54:17 -0500 Subject: [PATCH] Provide option to apply Cleanroom to any Forge-like server type (#4338) --- .../types-and-platforms/server-types/forge.md | 22 ++++++++- examples/cleanroom/compose.yml | 2 +- scripts/start-applyCleanroom | 48 +++++++++++++++++++ scripts/start-deployCleanroom | 48 +------------------ scripts/start-setupModpack | 9 ++++ 5 files changed, 81 insertions(+), 48 deletions(-) create mode 100644 scripts/start-applyCleanroom diff --git a/docs/types-and-platforms/server-types/forge.md b/docs/types-and-platforms/server-types/forge.md index a83e486b..34c2ff5c 100644 --- a/docs/types-and-platforms/server-types/forge.md +++ b/docs/types-and-platforms/server-types/forge.md @@ -87,4 +87,24 @@ Support for [NeoForge](https://neoforged.net/) is also provided. A NeoForge serv FORGE_INSTALLER_URL: https://github.com/CleanroomMC/Cleanroom/releases/download/0.2.4-alpha/cleanroom-0.2.4-alpha-installer.jar ``` - [Full example](https://github.com/itzg/docker-minecraft-server/tree/master/examples/cleanroom) \ No newline at end of file + [Full example](https://github.com/itzg/docker-minecraft-server/tree/master/examples/cleanroom) + +#### Apply Cleanroom + +As an alternative to replacing the `TYPE` as "cleanroom", you can use any of the Forge-like types above, including `AUTO_CURSEFORGE` described [here](../mod-platforms/auto-curseforge.md), and apply Cleanroom as the loader by setting the environment variable `APPLY_CLEANROOM` to "true". + +All the configuration options described above can be used with this. + +!!! warning + + As mentioned above, Cleanroom **only works with 1.12.2**, so be sure to utilize modpacks and mods that are compatible with 1.12.2. If using a `TYPE` of "forge" or "neoforge", be sure to set `VERSION` to "1.12.2". + +!!! example + + ```yaml + environment: + EULA: true + TYPE: AUTO_CURSEFORGE + CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/enigmatica2expert/files/9088147 + APPLY_CLEANROOM: true + ``` \ No newline at end of file diff --git a/examples/cleanroom/compose.yml b/examples/cleanroom/compose.yml index 5539079b..31be6fa3 100644 --- a/examples/cleanroom/compose.yml +++ b/examples/cleanroom/compose.yml @@ -22,7 +22,7 @@ services: # CLEANROOM_FROM_URL: https:// volumes: # use a named, managed volume for data volume - - mc_data:/data + - mc-data:/data # attach local host directory "mods" in same directory as this compose file # all mods in this directory get copied into /data/mods at startup - ./mods:/mods:ro diff --git a/scripts/start-applyCleanroom b/scripts/start-applyCleanroom new file mode 100644 index 00000000..485c5d56 --- /dev/null +++ b/scripts/start-applyCleanroom @@ -0,0 +1,48 @@ +#!/bin/bash + +: "${CLEANROOM_FORCE_REINSTALL:=false}" + +# shellcheck source=start-utils +. "${SCRIPTS:-$(dirname "$0")}/start-utils" +isDebugging && set -x +resultsFile=/data/.run-cleanroom.env + +declare -a cleanroom_installer_options +cleanroom_installer_options+=(--output-directory=/data) +cleanroom_installer_options+=(--results-file="${resultsFile}") +cleanroom_installer_options+=(--force-reinstall="${CLEANROOM_FORCE_REINSTALL}") + +if [[ ${CLEANROOM_LOADER_VERSION} ]]; then + cleanroom_installer_options+=(--loader-version="${CLEANROOM_LOADER_VERSION}") +fi + +if [[ ${CLEANROOM_INSTALLER_VERSION} ]]; then + cleanroom_installer_options+=(--installer-version="${CLEANROOM_INSTALLER_VERSION}") +fi + +if [[ ${CLEANROOM_FROM_FILE} ]]; then + cleanroom_installer_options+=(--from-local-file="${CLEANROOM_FROM_FILE}") +fi + +if [[ ${CLEANROOM_FROM_URL} ]]; then + cleanroom_installer_options+=(--from-url="${CLEANROOM_FROM_URL}") +fi + +if [[ ${CLEANROOM_MAVEN_URL} ]]; then + cleanroom_installer_options+=(--cleanroom-maven-url="${CLEANROOM_MAVEN_URL}") +fi + +if ! mc-image-helper install-cleanroom "${cleanroom_installer_options[@]}" ; then + if [[ ${CLEANROOM_FROM_FILE} ]]; then + logError "Failed to install Cleanroom given installer ${CLEANROOM_FROM_FILE}" + elif [[ ${CLEANROOM_FROM_URL:-} ]]; then + logError "Failed to install Cleanroom from ${CLEANROOM_FROM_URL}" + else + logError "Failed to install Cleanroom" + fi + exit 1 +fi + +applyResultsFile ${resultsFile} + +export FAMILY=FORGE \ No newline at end of file diff --git a/scripts/start-deployCleanroom b/scripts/start-deployCleanroom index cb50b7b4..ca7879a0 100644 --- a/scripts/start-deployCleanroom +++ b/scripts/start-deployCleanroom @@ -1,50 +1,6 @@ #!/bin/bash -: "${CLEANROOM_FORCE_REINSTALL:=false}" - -# shellcheck source=start-utils -. "${SCRIPTS:-$(dirname "$0")}/start-utils" -isDebugging && set -x -resultsFile=/data/.run-cleanroom.env - -declare -a cleanroom_installer_options -cleanroom_installer_options+=(--output-directory=/data) -cleanroom_installer_options+=(--results-file="${resultsFile}") -cleanroom_installer_options+=(--force-reinstall="${CLEANROOM_FORCE_REINSTALL}") - -if [[ ${CLEANROOM_LOADER_VERSION} ]]; then - cleanroom_installer_options+=(--loader-version="${CLEANROOM_LOADER_VERSION}") -fi - -if [[ ${CLEANROOM_INSTALLER_VERSION} ]]; then - cleanroom_installer_options+=(--installer-version="${CLEANROOM_INSTALLER_VERSION}") -fi - -if [[ ${CLEANROOM_FROM_FILE} ]]; then - cleanroom_installer_options+=(--from-local-file="${CLEANROOM_FROM_FILE}") -fi - -if [[ ${CLEANROOM_FROM_URL} ]]; then - cleanroom_installer_options+=(--from-url="${CLEANROOM_FROM_URL}") -fi - -if [[ ${CLEANROOM_MAVEN_URL} ]]; then - cleanroom_installer_options+=(--cleanroom-maven-url="${CLEANROOM_MAVEN_URL}") -fi - -if ! mc-image-helper install-cleanroom "${cleanroom_installer_options[@]}" ; then - if [[ ${CLEANROOM_FROM_FILE} ]]; then - logError "Failed to install Cleanroom given installer ${CLEANROOM_FROM_FILE}" - elif [[ ${CLEANROOM_FROM_URL:-} ]]; then - logError "Failed to install Cleanroom from ${CLEANROOM_FROM_URL}" - else - logError "Failed to install Cleanroom" - fi - exit 1 -fi - -applyResultsFile ${resultsFile} - -export FAMILY=FORGE +# run within the current shell to retain exported environment variables +. "$(dirname "$0")/start-applyCleanroom" exec "$(dirname "$0")/start-setupWorld" "$@" diff --git a/scripts/start-setupModpack b/scripts/start-setupModpack index 1ce863d6..f66c6816 100755 --- a/scripts/start-setupModpack +++ b/scripts/start-setupModpack @@ -409,4 +409,13 @@ case "X$MODCONFIG" in esac fi +if isTrue "${APPLY_CLEANROOM}"; then + if [[ "$VERSION" != "1.12.2" ]]; then + logError "Cleanroom only works with Minecraft version 1.12.2. Current version is $VERSION." + exit 1 + fi + # run within the current shell to retain exported environment variables + . "$(dirname "$0")/start-applyCleanroom" +fi + exec "$(dirname "$0")/start-setupMounts" "$@"