modrinth: add MODRINTH_OVERRIDES_EXCLUSIONS option (#2703)

This commit is contained in:
Geoff Bourne 2024-03-09 13:44:27 -06:00 committed by GitHub
parent 01be571535
commit ca352c2355
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 67 additions and 2 deletions

View File

@ -49,7 +49,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_HELPER_VERSION=1.38.5
ARG MC_HELPER_VERSION=1.38.7
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1

View File

@ -59,4 +59,35 @@ To exclude client mods that are incorrectly declared by the modpack as server-co
notenoughanimations
lambdynamiclights
euphoriapatcher
```
```
## Excluding Overrides Files
Modrinth mrpack/zip files may include an `overrides` subdirectory that contains config files, world data, and extra mod files. All of those files will be extracted into the `/data` path of the container. If any of those files, such as incompatible mods, need to be excluded from extraction, then the `MODRINTH_OVERRIDES_EXCLUSIONS` variable can be set with a comma or newline delimited list of ant-style paths ([see below](#ant-style-paths)) to exclude, relative to the overrides (or `/data`) directory.
### Ant-style paths
Ant-style paths can include the following globbing/wildcard symbols:
| Symbol | Behavior |
|--------|---------------------------------------------------------|
| `*` | Matches zero, one, or many characters except a slash |
| `**` | Matches zero, one, or many characters including slashes |
| `?` | Matches one character |
!!! example
The following compose `environment` entries show how to exclude Iris and Sodium mods from the overrides
```yaml
MODRINTH_OVERRIDES_EXCLUSIONS: mods/NekosEnchantedBooks-*.jar,mods/citresewn-*.jar
```
or using newline delimiter, which improves maintainability
```yaml
MODRINTH_OVERRIDES_EXCLUSIONS: |
mods/NekosEnchantedBooks-*.jar
mods/citresewn-*.jar
```

View File

@ -0,0 +1,32 @@
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
TYPE: MODRINTH
MEMORY: 4G
MODRINTH_MODPACK: better-mc-forge-bmc4
MODRINTH_VERSION: v4
MODRINTH_FORCE_SYNCHRONIZE: true
MODRINTH_EXCLUDE_FILES: |
citresewn
oculus
yungsmenutweaks
notenoughanimations
ryoamiclights
euphoriapatcher
entity_model_features
entity_texture_features
3dskinlayers
MODRINTH_OVERRIDES_EXCLUSIONS: |
mods/NekosEnchantedBooks-*.jar
mods/citresewn-*.jar
DEBUG: true
SETUP_ONLY: true
volumes:
- data:/data
ports:
- "25565:25565"
volumes:
data: {}

View File

@ -11,6 +11,7 @@ resultsFile=/data/.install-modrinth.env
: "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}"
: "${MODRINTH_IGNORE_MISSING_FILES:=}"
: "${MODRINTH_EXCLUDE_FILES:=}"
: "${MODRINTH_OVERRIDES_EXCLUSIONS:=}"
if [[ ! $MODRINTH_MODPACK ]]; then
log "ERROR: MODRINTH_MODPACK must be set when using TYPE/MOD_PLATFORM of MODRINTH"
@ -56,6 +57,7 @@ setArg --loader MODRINTH_LOADER
setArg --version MODRINTH_VERSION
setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE
setArg --exclude-files MODRINTH_EXCLUDE_FILES
setArg --overrides-exclusions MODRINTH_OVERRIDES_EXCLUSIONS
if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
log "ERROR failed to install Modrinth modpack"