Use slugs or IDs for include/excludes with AUTO_CURSEFORGE and option for file declaration (#1905)

This commit is contained in:
Geoff Bourne 2023-01-14 12:52:35 -06:00 committed by GitHub
parent 14cf300e82
commit b23593aec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 24 deletions

View File

@ -46,7 +46,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.24.8
ARG MC_HELPER_VERSION=1.24.9
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
| tar -C /usr/share -zxf - \
@ -64,6 +64,7 @@ COPY --chmod=755 scripts/start* /
COPY --chmod=755 bin/ /usr/local/bin/
COPY --chmod=755 bin/mc-health /health.sh
COPY --chmod=644 files/log4j2.xml /image/log4j2.xml
COPY --chmod=644 files/cf-exclude-include.json /image/cf-exclude-include.json
COPY --chmod=755 files/auto /auto
RUN dos2unix /start* /auto/*

View File

@ -651,11 +651,18 @@ The following two examples both refer to version 1.0.7 of ATM8:
-e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8 -e CF_FILENAME_MATCHER=1.0.7
```
If there are mods that need to be excluded, such as ones that did not properly declare as a client mod via the file's game versions, then they can be excluded by passing a comma or space delimited list of project IDs via `CF_EXCLUDE_MODS`. Similarly, there are some mods that are incorrectly tagged as client only. For those, pass the project IDs via `CF_FORCE_INCLUDE_MODS`. Known, mis-tagged mods have been included in the defaults.
A lot of the time there are mods that need to be excluded, such as ones that did not properly declare as a client mod via the file's game versions. Similarly, there are some mods that are incorrectly tagged as client only. The following describes two options to exclude/include mods:
Global and per modpack exclusions can be declared in a JSON file and referenced with `CF_EXCLUDE_INCLUDE_FILE`. By default, [the file bundled with the image](files/cf-exclude-include.json) will be used. The schema of this file [is documented here](https://github.com/itzg/mc-image-helper#excludeinclude-file-schema).
Alternatively, they can be excluded by passing a comma or space delimited list of **project** slugs or IDs via `CF_EXCLUDE_MODS`. Similarly, there are some mods that are incorrectly tagged as client only. For those, pass the **project** slugs or IDs via `CF_FORCE_INCLUDE_MODS`. If either of these are set, then `CF_EXCLUDE_INCLUDE_FILE` will be **disabled**.
If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true" to ensure the exclude/includes are re-evaluated.
> **NOTE:** these options are provided to empower you get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing.
Other configuration available:
- `CF_PARALLEL_DOWNLOADS` (default is 4): specify how many parallel mod downloads to perform
- `CF_FORCE_SYNCHRONIZE`: set to "true" to force the inputs and exclusions to be re-evaluated
### Old approach

View File

@ -0,0 +1,18 @@
{
"globalExcludes": [
"oculus",
"extreme-sound-muffler",
"entityculling",
"rubidium",
"nekos-enchanted-books",
"skin-layers-3d",
"not-enough-animations",
"entity-texture-features-fabric",
"carry-on",
"ignitioncoil",
"defensive-measures"
],
"globalForceIncludes": [
"revelationary"
]
}

View File

@ -10,6 +10,9 @@ set -eu
: "${CF_FILENAME_MATCHER:=}"
: "${CF_PARALLEL_DOWNLOADS:=4}"
: "${CF_FORCE_SYNCHRONIZE:=false}"
: "${CF_EXCLUDE_INCLUDE_FILE:=/image/cf-exclude-include.json}"
: "${CF_EXCLUDE_MODS:=}"
: "${CF_FORCE_INCLUDE_MODS:=}"
resultsFile=/data/.install-curseforge.env
@ -35,27 +38,18 @@ args+=(
--force-synchronize="$CF_FORCE_SYNCHRONIZE"
)
defaultModExcludes=(
581495 # oculus
363363 # extreme-sound-muffler
448233 # entityculling
574856 # rubidium
441114 # nekos-enchanted-books
521480 # skin-layers-3d
433760 # not-enough-animations
568563 # entity-texture-features-fabric
274259 # carry-on
787666 # ignitioncoil, not a client mod, but doesn't seem to play nice with server mode
700629 # defensive-measures
)
: "${CF_EXCLUDE_MODS:=${defaultModExcludes[@]}}"
args+=(--exclude-mods="$CF_EXCLUDE_MODS")
defaultModForceIncludes=(
656526 # revelationary
)
: "${CF_FORCE_INCLUDE_MODS:=${defaultModForceIncludes[@]}}"
args+=(--force-include-mods="$CF_FORCE_INCLUDE_MODS")
if [[ $CF_EXCLUDE_MODS || $CF_FORCE_INCLUDE_MODS ]]; then
if [[ $CF_EXCLUDE_MODS ]]; then
args+=( --exclude-mods="$CF_EXCLUDE_MODS" )
fi
if [[ $CF_FORCE_INCLUDE_MODS ]]; then
args+=( --force-include-mods="$CF_FORCE_INCLUDE_MODS" )
fi
else
if [[ $CF_EXCLUDE_INCLUDE_FILE ]]; then
args+=( --exclude-include-file="$CF_EXCLUDE_INCLUDE_FILE" )
fi
fi
if ! mc-image-helper install-curseforge "${args[@]}"; then
log "ERROR failed to auto-install CurseForge modpack"