From 6f1f8d7806c72f45e4b5f36319565ee396a6e9dd Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 3 Oct 2020 14:34:02 -0500 Subject: [PATCH] Added use of REMOVE_OLD_MODS to /mods processing --- README.md | 2 +- start-minecraftFinalSetup | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78bc997b..1ef13abf 100644 --- a/README.md +++ b/README.md @@ -297,7 +297,7 @@ or downloading a world with the `WORLD` option. There are two additional volumes that can be mounted; `/mods` and `/config`. Any files in either of these filesystems will be copied over to the main -`/data` filesystem before starting Minecraft. +`/data` filesystem before starting Minecraft. If you want old mods to be removed as the `/mods` content is updated, then add `-e REMOVE_OLD_MODS=TRUE`. This works well if you want to have a common set of modules in a separate location, but still have multiple worlds with different server requirements diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index c2377d3a..c19a2a13 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -54,7 +54,10 @@ done if [ -d /mods ]; then log "Copying any mods over..." mkdir -p /data/mods - rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data + if isTrue "${REMOVE_OLD_MODS}"; then + rsyncArgs=(--delete) + fi + rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data fi [ -d /data/config ] || mkdir /data/config