From e045ca647c1a1e9808ea6acfa81c68ad7a81607d Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 24 Jun 2020 17:53:51 -0500 Subject: [PATCH] Improved upgrade handling by moving aside behavior_packs, etc --- README.md | 2 +- bedrock-entry.sh | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dbb58a5..c62f359 100644 --- a/README.md +++ b/README.md @@ -141,4 +141,4 @@ You can follow the logs of the deployment using: ```bash kubectl logs -f deployment/bds -``` \ No newline at end of file +``` diff --git a/bedrock-entry.sh b/bedrock-entry.sh index e77aa5a..17cb497 100755 --- a/bedrock-entry.sh +++ b/bedrock-entry.sh @@ -59,7 +59,18 @@ if [ ! -f "bedrock_server-${VERSION}" ]; then curl -o ${TMP_ZIP} -fsSL ${DOWNLOAD_URL} # remove only binaries and some docs, to allow for an upgrade of those - rm -f bedrock_server *.so release-notes.txt bedrock_server_how_to.html 2> /dev/null + rm -rf bedrock_server *.so release-notes.txt bedrock_server_how_to.html valid_known_packs.json premium_cache 2> /dev/null + + bkupDir=backup-pre-${VERSION} + for d in behavior_packs definitions minecraftpe resource_packs structures treatments world_templates + do + if [ -d $d ]; then + mkdir -p $bkupDir + echo "Backing up $d into $bkupDir" + mv $d $bkupDir + fi + done + # ... use -n to avoid overwriting any existing files with the archive's copy unzip -n -q ${TMP_ZIP} rm ${TMP_ZIP}