Added 'FORCE_WORLD_COPY' environment variable (#580)

This commit is contained in:
Paul Zühlcke 2020-07-11 00:06:47 +02:00 committed by GitHub
parent cf691499a1
commit 092b530537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -947,6 +947,9 @@ read-only volume attachment to ensure the clone source remains pristine.
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
``` ```
### Overwrite world on start
The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start.
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers ### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers
Like the `WORLD` option above, you can specify the URL of a "mod pack" Like the `WORLD` option above, you can specify the URL of a "mod pack"

View File

@ -10,7 +10,7 @@ else
worldDest=/data/$LEVEL worldDest=/data/$LEVEL
fi fi
if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then if [[ "$WORLD" ]] && isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ]; then
if isURL $WORLD; then if isURL $WORLD; then
curl -fsSL "$WORLD" -o /tmp/world.zip curl -fsSL "$WORLD" -o /tmp/world.zip
zipSrc=/tmp/world.zip zipSrc=/tmp/world.zip
@ -37,10 +37,10 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
log "ERROR invalid world content" log "ERROR invalid world content"
exit 1 exit 1
fi fi
mv "$baseDir" "$worldDest" rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
else else
log "Cloning world directory from $WORLD ..." log "Cloning world directory from $WORLD ..."
cp -r "$WORLD" "$worldDest" rsync --recursive --delete "${WORLD%/}"/ "$worldDest"
fi fi
if [ "$TYPE" = "SPIGOT" ]; then if [ "$TYPE" = "SPIGOT" ]; then