mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 14:24:28 +00:00
Allow for multiple patterns in REMOVE_OLD_MODS_INCLUDE/EXCLUDE (#1637)
This commit is contained in:
parent
c83705157c
commit
8dbfff1873
7 changed files with 21 additions and 7 deletions
|
@ -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.20.1
|
||||
ARG MC_HELPER_VERSION=1.20.3
|
||||
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 - \
|
||||
|
|
|
@ -660,7 +660,9 @@ There are optional volume paths that can be attached to supply content to be cop
|
|||
|
||||
By default, the [environment variable processing](#replacing-variables-inside-configs) is performed on synchronized files that match the expected suffixes in `REPLACE_ENV_SUFFIXES` (by default "yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml") and are not excluded by `REPLACE_ENV_VARIABLES_EXCLUDES` and `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`. This processing can be disabled by setting `REPLACE_ENV_DURING_SYNC` to `false`.
|
||||
|
||||
If you want old mods/plugins to be removed before the content is brought over from those attach points, then add `-e REMOVE_OLD_MODS=TRUE`. You can fine tune the removal process by specifying the `REMOVE_OLD_MODS_INCLUDE` and `REMOVE_OLD_MODS_EXCLUDE` variables. By default, everything will be removed. You can also specify the `REMOVE_OLD_MODS_DEPTH` (default is 16) variable to only delete files up to a certain level.
|
||||
If you want old mods/plugins to be removed before the content is brought over from those attach points, then add `-e REMOVE_OLD_MODS=TRUE`. You can fine tune the removal process by specifying the `REMOVE_OLD_MODS_INCLUDE` and `REMOVE_OLD_MODS_EXCLUDE` variables, which are comma separated lists of file glob patterns. If a directory is excluded, then it and all of its contents are excluded. By default, only jars are removed.
|
||||
|
||||
You can also specify the `REMOVE_OLD_MODS_DEPTH` (default is 16) variable to only delete files up to a certain level.
|
||||
|
||||
For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
|
||||
|
||||
|
|
|
@ -3,13 +3,16 @@ version: "3"
|
|||
services:
|
||||
mc:
|
||||
# Only using IMAGE variable to allow for local testing
|
||||
image: ${IMAGE:-itzg/minecraft-server}
|
||||
image: itzg/minecraft-server
|
||||
# image: ${IMAGE:-itzg/minecraft-server}
|
||||
ports:
|
||||
- "25565:25565"
|
||||
environment:
|
||||
EULA: "TRUE"
|
||||
TYPE: SPIGOT
|
||||
SPIGET_RESOURCES: 34315,3836
|
||||
# SPIGET_RESOURCES: 34315,3836
|
||||
SPIGET_RESOURCES: ""
|
||||
REMOVE_OLD_MODS: "true"
|
||||
volumes:
|
||||
- data:/data
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ set -e -o pipefail
|
|||
: "${MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES:=false}"
|
||||
: "${MODS_FORGEAPI_IGNORE_GAMETYPE:=false}"
|
||||
: "${REMOVE_OLD_MODS_DEPTH:=1} "
|
||||
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar}"
|
||||
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar,*-version.json}"
|
||||
|
||||
# FORGEAPI_BASE_URL used in manifest downloads below
|
||||
FORGEAPI_BASE_URL=${FORGEAPI_BASE_URL:-https://api.curseforge.com/v1}
|
||||
|
|
|
@ -5,7 +5,7 @@ set -e -o pipefail
|
|||
: "${REMOVE_OLD_MODS:=false}"
|
||||
: "${MODS_FILE:=}"
|
||||
: "${REMOVE_OLD_MODS_DEPTH:=1} "
|
||||
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar}"
|
||||
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar,*-version.json}"
|
||||
sum_file=/data/.generic_pack.sum
|
||||
|
||||
# shellcheck source=start-utils
|
||||
|
|
|
@ -8,6 +8,7 @@ handleDebugMode
|
|||
|
||||
: "${SPIGET_RESOURCES:=}"
|
||||
: "${SPIGET_DOWNLOAD_TOLERANCE:=5}" # in minutes
|
||||
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar,*-version.json}"
|
||||
|
||||
acceptArgs=(--accept application/zip --accept application/java-archive --accept application/octet-stream)
|
||||
|
||||
|
|
|
@ -207,7 +207,15 @@ eula=${EULA,,}
|
|||
|
||||
function removeOldMods {
|
||||
if [ -d "$1" ]; then
|
||||
find "$1" -mindepth 1 -maxdepth ${REMOVE_OLD_MODS_DEPTH:-16} -wholename "${REMOVE_OLD_MODS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_MODS_EXCLUDE:-}" -delete
|
||||
log "Removing old mods including:${REMOVE_OLD_MODS_INCLUDE} excluding:${REMOVE_OLD_MODS_EXCLUDE}"
|
||||
mc-image-helper find \
|
||||
--delete \
|
||||
--type file,directory \
|
||||
--min-depth=1 --max-depth "${REMOVE_OLD_MODS_DEPTH:-16}" \
|
||||
--name "${REMOVE_OLD_MODS_INCLUDE:-*}" \
|
||||
--exclude-name "${REMOVE_OLD_MODS_EXCLUDE:-}" \
|
||||
--quiet \
|
||||
"$1"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue