From 6f5ed33c6a7bc03acbe235459f57bbb8c0174e47 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 11 Mar 2023 14:42:20 +0000 Subject: [PATCH] a --- lgsm/functions/update_factorio.sh | 1 + lgsm/functions/update_jediknight2.sh | 1 + lgsm/functions/update_minecraft.sh | 1 + lgsm/functions/update_minecraft_bedrock.sh | 1 + lgsm/functions/update_mta.sh | 1 + lgsm/functions/update_ts3.sh | 1 + lgsm/functions/update_ut99.sh | 17 +++++++------- lgsm/functions/update_vintagestory.sh | 27 +++++++++++----------- 8 files changed, 28 insertions(+), 22 deletions(-) diff --git a/lgsm/functions/update_factorio.sh b/lgsm/functions/update_factorio.sh index 138ccdab1..c573a034a 100644 --- a/lgsm/functions/update_factorio.sh +++ b/lgsm/functions/update_factorio.sh @@ -98,6 +98,7 @@ fn_update_factorio_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 + sleep 5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/functions/update_jediknight2.sh b/lgsm/functions/update_jediknight2.sh index 402c43539..31314d5c5 100644 --- a/lgsm/functions/update_jediknight2.sh +++ b/lgsm/functions/update_jediknight2.sh @@ -90,6 +90,7 @@ fn_update_jk2_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 + sleep 5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/functions/update_minecraft.sh b/lgsm/functions/update_minecraft.sh index bb7aecaeb..b87215a26 100644 --- a/lgsm/functions/update_minecraft.sh +++ b/lgsm/functions/update_minecraft.sh @@ -110,6 +110,7 @@ fn_update_minecraft_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 + sleep 5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/functions/update_minecraft_bedrock.sh b/lgsm/functions/update_minecraft_bedrock.sh index 91aa2c3fd..cdd0a01e4 100644 --- a/lgsm/functions/update_minecraft_bedrock.sh +++ b/lgsm/functions/update_minecraft_bedrock.sh @@ -103,6 +103,7 @@ fn_update_minecraft_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 + sleep 5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/functions/update_mta.sh b/lgsm/functions/update_mta.sh index feb988360..79f8373c5 100644 --- a/lgsm/functions/update_mta.sh +++ b/lgsm/functions/update_mta.sh @@ -98,6 +98,7 @@ fn_update_mta_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 + sleep 5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index aa36fe8d5..4c5271a39 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -105,6 +105,7 @@ fn_update_ts3_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 + sleep 5 command_stop.sh fn_firstcommand_reset fi diff --git a/lgsm/functions/update_ut99.sh b/lgsm/functions/update_ut99.sh index 15d632135..fd5bff16c 100644 --- a/lgsm/functions/update_ut99.sh +++ b/lgsm/functions/update_ut99.sh @@ -8,9 +8,6 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_ut99_dl() { - remotebuildurl=$(curl --connect-timeout 10 -sL "https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .browser_download_url') - remotebuildfilename=$(curl --connect-timeout 10 -sL "https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .name') - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "nohash" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" echo "${remotebuild}" > "${serverfiles}/build.txt" @@ -33,12 +30,16 @@ fn_update_ut99_localbuild() { } fn_update_ut99_remotebuild() { - # Gets remote build info. - remotebuild=$(curl -s "https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest" | jq -r '.tag_name') + # Get remote build info. + apiurl="https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest" + remotebuildresponse=$(curl -s "${apiurl}") + remotebuildfilename=$(echo -e "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .name') + remotebuildurl=$(echo -e "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .browser_download_url') + remotebuildversion=$(echo -e "${remotebuildresponse}" | jq -r '.tag_name') if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" - # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then + # Checks if remotebuildversion variable has been set. + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -48,7 +49,7 @@ fn_update_ut99_remotebuild() { fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh diff --git a/lgsm/functions/update_vintagestory.sh b/lgsm/functions/update_vintagestory.sh index 1ed336eae..5efedd80b 100755 --- a/lgsm/functions/update_vintagestory.sh +++ b/lgsm/functions/update_vintagestory.sh @@ -8,15 +8,9 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_vs_dl() { - # get version info for download - remotebuildresponse=$(curl -s "${apiurl}" | jq --arg version "${remotebuild}" '.[$version].server') - remotebuildfile=$(echo -e "${remotebuildresponse}" | jq -r '.filename') - remotebuildurl=$(echo -e "${remotebuildresponse}" | jq -r '.urls.cdn') - remotebuildmd5=$(echo -e "${remotebuildresponse}" | jq -r '.md5') - # Download and extract files to serverfiles - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfile}" "nochmodx" "norun" "force" "${remotebuildmd5}" - fn_dl_extract "${tmpdir}" "${remotebuildfile}" "${serverfiles}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildmd5}" + fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" fn_clear_tmp } @@ -38,16 +32,21 @@ fn_update_vs_localbuild() { } fn_update_vs_remotebuild() { + apiurl="http://api.vintagestory.at/stable-unstable.json" + remotebuildresponse=$(curl -s "${apiurl}") if [ "${branch}" == "stable" ]; then - remotebuild=$(curl -s "${apiurl}" | jq -r '[ to_entries[] ] | .[].key' | grep -Ev "\-rc|\-pre" | sort -r -V | head -1) + remotebuildversion=$(echo -e "${remotebuildresponse}" | jq -r '[ to_entries[] ] | .[].key' | grep -Ev "\-rc|\-pre" | sort -r -V | head -1) else - remotebuild=$(curl -s "${apiurl}" | jq -r '[ to_entries[] ] | .[].key' | grep -E "\-rc|\-pre" | sort -r -V | head -1) + remotebuildversion=$(echo -e "${remotebuildresponse}" | jq -r '[ to_entries[] ] | .[].key' | grep -E "\-rc|\-pre" | sort -r -V | head -1) fi + remotebuildfilename=$(echo -e "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].server.filename') + remotebuildurl=$(echo -e "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].server.filename') + remotebuildmd5=$(echo -e "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].server.filename') if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" - # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then + # Checks if remotebuildversion variable has been set. + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh @@ -57,7 +56,7 @@ fn_update_vs_remotebuild() { fi else # Checks if remotebuild variable has been set. - if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then fn_print_failure "Unable to get remote build" fn_script_log_fatal "Unable to get remote build" core_exit.sh @@ -94,6 +93,7 @@ fn_update_vs_compare() { command_start.sh fn_firstcommand_reset exitbypass=1 + sleep 5 command_stop.sh fn_firstcommand_reset fi @@ -137,7 +137,6 @@ fn_update_vs_compare() { # The location where the builds are checked and downloaded. remotelocation="vintagestory.at" -apiurl="http://api.${remotelocation}/stable-unstable.json" if [ "${firstcommandname}" == "INSTALL" ]; then fn_update_vs_remotebuild