Skip to content

Commit

Permalink
Fixed issue of unbound REMOVE_OLD_MODS_EXCLUDE variable when using SP…
Browse files Browse the repository at this point in the history
…IGET_RESOURCES (#2891)
  • Loading branch information
itzg authored Jun 12, 2024
1 parent 87afad6 commit 2e9be59
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# NOTE
# This file is named spiget with an "e"
# since it provides an example of the
# This file is purposely named spiget with an "e" since it provides an example of the
# feature https://docker-minecraft-server.readthedocs.io/en/latest/mods-and-plugins/spiget/
# which uses the Spiget API at https://spiget.org/

Expand All @@ -13,8 +12,6 @@ services:
EULA: "TRUE"
TYPE: PAPER
SPIGET_RESOURCES: 34315,3836
REMOVE_OLD_MODS: true
volumes:
- data:/data

volumes:
data: {}
- ./data:/data
5 changes: 4 additions & 1 deletion scripts/start-spiget
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ handleDebugMode

: "${SPIGET_RESOURCES:=}"
: "${SPIGET_DOWNLOAD_TOLERANCE:=5}" # in minutes
: "${REMOVE_OLD_MODS:=false}"
: "${REMOVE_OLD_MODS_EXCLUDE:=}"
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar,*-version.json}"
: "${REMOVE_OLD_MODS_DEPTH:=1} "

acceptArgs=(--accept application/zip --accept application/java-archive --accept application/octet-stream)

Expand Down Expand Up @@ -127,7 +130,7 @@ downloadResourceFromSpiget() {
}

if [[ ${SPIGET_RESOURCES} ]]; then
if isTrue "${REMOVE_OLD_MODS:-false}"; then
if isTrue "${REMOVE_OLD_MODS}"; then
removeOldMods /data/plugins
REMOVE_OLD_MODS=false
fi
Expand Down
8 changes: 4 additions & 4 deletions scripts/start-utils
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ eula=${EULA,,}

function removeOldMods {
if [ -d "$1" ]; then
log "Removing old mods including:${REMOVE_OLD_MODS_INCLUDE} excluding:${REMOVE_OLD_MODS_EXCLUDE}"
log "Removing old mods including='${REMOVE_OLD_MODS_INCLUDE}' excluding='${REMOVE_OLD_MODS_EXCLUDE}' up to depth=${REMOVE_OLD_MODS_DEPTH}"
args=(
--delete
--type file
--min-depth=1 --max-depth "${REMOVE_OLD_MODS_DEPTH:-16}"
--name "${REMOVE_OLD_MODS_INCLUDE:-*}"
--exclude-name "${REMOVE_OLD_MODS_EXCLUDE:-}"
--min-depth=1 --max-depth "${REMOVE_OLD_MODS_DEPTH}"
--name "${REMOVE_OLD_MODS_INCLUDE}"
--exclude-name "${REMOVE_OLD_MODS_EXCLUDE}"
)
if ! isDebugging; then
args+=(--quiet)
Expand Down

0 comments on commit 2e9be59

Please sign in to comment.