From fdf5fb46bc767413706f41db07a574ea0fe9afde Mon Sep 17 00:00:00 2001 From: Dubhar <77026787+Dubhar@users.noreply.github.com> Date: Sat, 9 Jan 2021 18:03:21 +0100 Subject: [PATCH] fix/681 (#719) * [shellcheck] prevent globbing * fix/681 remove old PaperMC before downloading new Fixes #681 Co-authored-by: Dubhar --- start-deployPaper | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/start-deployPaper b/start-deployPaper index 9233f7a0..5bc7a02c 100644 --- a/start-deployPaper +++ b/start-deployPaper @@ -28,7 +28,7 @@ else VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]') log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC" # re-execute the current script with the newly computed version - exec $0 "$@" + exec "$0" "$@" fi log "ERROR: ${VANILLA_VERSION} is not published by PaperMC" log " Set VERSION to one of the following: " @@ -56,6 +56,10 @@ else zarg=(-z "$SERVER") fi + log "Removing old PaperMC versions ..." + paperJarSearchString=${SERVER/$build/[0-9]*} + find . -name "$paperJarSearchString" ! -name "$SERVER" -delete -print + log "Downloading PaperMC $VANILLA_VERSION (build $build) ..." curl -fsSL -o "$SERVER" "${zarg[@]}" \ "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \ @@ -71,4 +75,4 @@ export TYPE=SPIGOT export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetupWorld $@ +exec ${SCRIPTS:-/}start-finalSetupWorld "$@"