From 6bd17366e1e8d207cff0df54b7f0449d9c4c5e28 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 9 Apr 2023 15:42:18 +0100 Subject: [PATCH] fix(update): repair mc and pmc updater fix behavior of how the download of the jar file is handled. --- lgsm/functions/update_factorio.sh | 2 +- lgsm/functions/update_jediknight2.sh | 2 +- lgsm/functions/update_minecraft.sh | 6 ++++-- lgsm/functions/update_minecraft_bedrock.sh | 2 +- lgsm/functions/update_papermc.sh | 11 ++++++----- lgsm/functions/update_ts3.sh | 2 +- lgsm/functions/update_ut99.sh | 4 ++-- lgsm/functions/update_vintagestory.sh | 2 +- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index 3fad634164..852ab9d87e 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - # Download and extract files to serverfiles + # Download and extract files to serverfiles. fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash" fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuildversion}.tar.xz" "${serverfiles}" "factorio" fn_clear_tmp diff --git a/lgsm/functions/update_jediknight2.sh b/lgsm/functions/update_jediknight2.sh index 7560f01580..a88b96f61f 100644 --- a/lgsm/functions/update_jediknight2.sh +++ b/lgsm/functions/update_jediknight2.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - # Download and extract files to serverfiles + # Download and extract files to serverfiles. fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}/GameData" "linux-amd64" fn_clear_tmp diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index 04b4e9d04f..dbef26d341 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -8,8 +8,9 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - # Download and extract files to serverfiles - fn_fetch_file "${remotebuildurl}" "" "" "" "${serverfiles}" "minecraft_server.jar" "chmodx" "norun" "noforce" "nohash" + # Download and extract files to serverfiles. + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "noforce" "nohash" + cp -f "${tmpdir}/${remotebuildfilename}" "${serverfiles}/${executable#./}" } fn_update_localbuild() { @@ -45,6 +46,7 @@ fn_update_remotebuild() { else remotebuildversion=$(echo "${remotebuildresponse}" | jq -r --arg branch "${branch}" --arg mcversion "${mcversion}" '.versions | .[] | select(.type==$branch and .id==$mcversion) | .id') fi + remotebuildfilename="minecraft_server.${remotebuildversion}.jar" # Generate link to version manifest json. remotebuildmanifest=$(echo "${remotebuildresponse}" | jq -r --arg branch "${branch}" --arg mcversion "${remotebuildversion}" '.versions | .[] | select(.type==$branch and .id==$mcversion) | .url') # Generate link to server.jar diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh index cf61e3a2b1..aec9401268 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/functions/update_minecraft_bedrock.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "bedrock_server.${remotebuildversion}.zip" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "bedrock_server.${remotebuildversion}.zip" "nochmodx" "norun" "noforce" "nohash" echo -e "Extracting to ${serverfiles}...\c" if [ "${firstcommandname}" == "INSTALL" ]; then unzip -oq "${tmpdir}/bedrock_server.${remotebuildversion}.zip" -x "server.properties" -d "${serverfiles}" diff --git a/lgsm/functions/update_papermc.sh b/lgsm/functions/update_papermc.sh index f48a66e39f..102ef65701 100644 --- a/lgsm/functions/update_papermc.sh +++ b/lgsm/functions/update_papermc.sh @@ -8,16 +8,17 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - # Download and extract files to serverfiles - fn_fetch_file "${remotebuildurl}" "" "" "" "${serverfiles}" "${executable#./}" "chmodx" "norun" "force" "${remotebuildhash}" + # Download and extract files to serverfiles. + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "force" "${remotebuildhash}" + cp -f "${tmpdir}/${remotebuildfilename}" "${serverfiles}/${executable#./}" echo "${remotebuildversion}" > "${serverfiles}/build.txt" } fn_update_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" - # Uses version file to get local build. - localbuild=$(head -n 1 "${serverfiles}/build.txt") + # Uses build file to get local build. + localbuild=$(head -n 1 "${serverfiles}/build.txt" 2> /dev/null) if [ -z "${localbuild}" ]; then fn_print_error "Checking local build: ${remotelocation}: missing local build info" fn_script_log_error "Missing local build info" @@ -31,7 +32,7 @@ fn_update_localbuild() { fn_update_remotebuild() { # Get remote build info. - apiurl="https://papermc.io/api/v2/projects/" + apiurl="https://papermc.io/api/v2/projects" # Get list of projects. remotebuildresponse=$(curl -s "${apiurl}") # Get list of Minecraft versions for project. diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index e76609b2dd..0f5327de28 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - # Download and extract files to serverfiles + # Download and extract files to serverfiles. fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" "teamspeak3-server_linux_${ts3arch}" fn_clear_tmp diff --git a/lgsm/functions/update_ut99.sh b/lgsm/functions/update_ut99.sh index b6db783e27..045b29dbe1 100644 --- a/lgsm/functions/update_ut99.sh +++ b/lgsm/functions/update_ut99.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - # Download and extract files to serverfiles + # Download and extract files to serverfiles. fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" echo "${remotebuildversion}" > "${serverfiles}/build.txt" @@ -19,7 +19,7 @@ fn_update_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses build file to get local build. - localbuild=$(head -n 1 "${serverfiles}/build.txt") + localbuild=$(head -n 1 "${serverfiles}/build.txt" 2> /dev/null) if [ -z "${localbuild}" ]; then fn_print_error "Checking local build: ${remotelocation}: missing local build info" fn_script_log_error "Missing local build info" diff --git a/lgsm/functions/update_vintagestory.sh b/lgsm/functions/update_vintagestory.sh index 67b6e1a3d1..7307a4b770 100755 --- a/lgsm/functions/update_vintagestory.sh +++ b/lgsm/functions/update_vintagestory.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { - # Download and extract files to serverfiles + # Download and extract files to serverfiles. fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" fn_clear_tmp