Added use of REMOVE_OLD_MODS to /mods processing

This commit is contained in:
Geoff Bourne 2020-10-03 14:34:02 -05:00
parent b06f1115d4
commit 6f1f8d7806
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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