From e2a5113cb729b27995eccf1ab52e943e056434ab Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 11 Mar 2023 20:57:25 +0000 Subject: [PATCH] add extractsrc and extractdest to deal with specific dir extracts --- lgsm/functions/command_mods_update.sh | 4 +- lgsm/functions/core_dl.sh | 32 +++++++--- lgsm/functions/install_eula.sh | 2 - lgsm/functions/install_ts3db.sh | 2 +- lgsm/functions/mods_core.sh | 18 +++--- lgsm/functions/update_ts3.sh | 88 ++++++++++++++++----------- lgsm/functions/update_ut99.sh | 46 ++++++++------ lgsm/functions/update_vintagestory.sh | 41 ++++++++----- 8 files changed, 146 insertions(+), 87 deletions(-) diff --git a/lgsm/functions/command_mods_update.sh b/lgsm/functions/command_mods_update.sh index c2f7b42b5..80b23fea9 100755 --- a/lgsm/functions/command_mods_update.sh +++ b/lgsm/functions/command_mods_update.sh @@ -27,8 +27,8 @@ fn_remove_cfg_files() { filetopreserve=$(echo -e "${modkeepfiles}" | awk -F ';' -v x=${preservefilesindex} '{ print $x }') echo -e " * serverfiles/${filetopreserve}" # If it matches an existing file that have been extracted delete the file. - if [ -f "${extractdir}/${filetopreserve}" ] || [ -d "${extractdir}/${filetopreserve}" ]; then - rm -r "${extractdir:?}/${filetopreserve}" + if [ -f "${extractdest}/${filetopreserve}" ] || [ -d "${extractdest}/${filetopreserve}" ]; then + rm -r "${extractdest:?}/${filetopreserve}" # Write the file path in a tmp file, to rebuild a full file list as it is rebuilt upon update. if [ ! -f "${modsdir}/.removedfiles.tmp" ]; then touch "${modsdir}/.removedfiles.tmp" diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index bfad5256c..716f0dc70 100755 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -202,17 +202,17 @@ fn_dl_hash() { # Extracts bzip2, gzip or zip files. # Extracts can be defined in code like so: -# fn_dl_extract "${local_filedir}" "${local_filename}" "${extractdir}" +# fn_dl_extract "${local_filedir}" "${local_filename}" "${extractdest}" "${extractsrc}" # fn_dl_extract "/home/gameserver/lgsm/tmp" "file.tar.bz2" "/home/gamserver/serverfiles" fn_dl_extract() { local_filedir="${1}" local_filename="${2}" - extractdir="${3}" + extractdest="${3}" # Extracts archives. echo -en "extracting ${local_filename}..." - if [ ! -d "${extractdir}" ]; then - mkdir "${extractdir}" + if [ ! -d "${extractdest}" ]; then + mkdir "${extractdest}" fi if [ ! -f "${local_filedir}/${local_filename}" ]; then fn_print_fail_eol_nl @@ -223,13 +223,29 @@ fn_dl_extract() { fi mime=$(file -b --mime-type "${local_filedir}/${local_filename}") if [ "${mime}" == "application/gzip" ] || [ "${mime}" == "application/x-gzip" ]; then - extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}") + if [ -n "${extractsec}" ]; then + extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdest}" "${extractsrc}") + else + extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdest}") + fi elif [ "${mime}" == "application/x-bzip2" ]; then - extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdir}") + if [ -n "${extractsrc}" ]; then + extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdest}" "${extractsrc}") + else + extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdest}") + fi elif [ "${mime}" == "application/x-xz" ]; then - extractcmd=$(tar -xf "${local_filedir}/${local_filename}" -C "${extractdir}") + if [ -n "${extractsrc}" ]; then + extractcmd=$(tar -Jxf "${local_filedir}/${local_filename}" -C "${extractdest}" "${extractsrc}") + else + extractcmd=$(tar -Jxf "${local_filedir}/${local_filename}" -C "${extractdest}") + fi elif [ "${mime}" == "application/zip" ]; then - extractcmd=$(unzip -qo -d "${extractdir}" "${local_filedir}/${local_filename}") + if [ -n "${extractsrc}" ]; then + extractcmd=$(unzip -qoj -d "${extractdest}" "${local_filedir}/${local_filename}" "${extractsrc}"/*) + else + extractcmd=$(unzip -qo -d "${extractdest}" "${local_filedir}/${local_filename}") + fi fi local exitcode=$? if [ "${exitcode}" != 0 ]; then diff --git a/lgsm/functions/install_eula.sh b/lgsm/functions/install_eula.sh index 5b8b4db5d..3e51fac71 100755 --- a/lgsm/functions/install_eula.sh +++ b/lgsm/functions/install_eula.sh @@ -31,11 +31,9 @@ if [ -z "${autoinstall}" ]; then fi elif [ "${commandname}" == "START" ]; then fn_print_info "By continuing you are indicating your agreement to the EULA." - echo -e "" sleep 5 else echo -e "By using auto-install you are indicating your agreement to the EULA." - echo -e "" sleep 5 fi diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh index 035077757..ed879cd28 100755 --- a/lgsm/functions/install_ts3db.sh +++ b/lgsm/functions/install_ts3db.sh @@ -64,7 +64,7 @@ fi install_eula.sh echo -e "" -echo -e "${lightyellow}Getting privilege key${default}" +echo -e "${lightyellow}Getting Privilege Key${default}" echo -e "=================================" fn_sleep_time fn_print_information_nl "Save these details for later." diff --git a/lgsm/functions/mods_core.sh b/lgsm/functions/mods_core.sh index e79ceb9ad..8e4ade771 100755 --- a/lgsm/functions/mods_core.sh +++ b/lgsm/functions/mods_core.sh @@ -10,7 +10,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Files and Directories. modsdir="${lgsmdir}/mods" modstmpdir="${modsdir}/tmp" -extractdir="${modstmpdir}/extract" +extractdest="${modstmpdir}/extract" modsinstalledlist="installed-mods.txt" modsinstalledlistfullpath="${modsdir}/${modsinstalledlist}" @@ -25,10 +25,10 @@ fn_mod_install_files() { fn_script_log_fatal "An issue occurred downloading ${modprettyname}" core_exit.sh fi - if [ ! -d "${extractdir}" ]; then - mkdir -p "${extractdir}" + if [ ! -d "${extractdest}" ]; then + mkdir -p "${extractdest}" fi - fn_dl_extract "${modstmpdir}" "${modfilename}" "${extractdir}" + fn_dl_extract "${modstmpdir}" "${modfilename}" "${extractdest}" } # Convert mod files to lowercase if needed. @@ -39,9 +39,9 @@ fn_mod_lowercase() { fn_sleep_time fn_script_log_info "Converting ${modprettyname} files to lowercase" # Total files and directories for the mod, to output to the user - fileswc=$(find "${extractdir}" | wc -l) + fileswc=$(find "${extractdest}" | wc -l) # Total uppercase files and directories for the mod, to output to the user - filesupperwc=$(find "${extractdir}" -name '*[[:upper:]]*' | wc -l) + filesupperwc=$(find "${extractdest}" -name '*[[:upper:]]*' | wc -l) fn_script_log_info "Found ${filesupperwc} uppercase files out of ${fileswc}, converting" echo -en "Found ${filesupperwc} uppercase files out of ${fileswc}, converting..." # Convert files and directories starting from the deepest to prevent issues (-depth argument) @@ -63,7 +63,7 @@ fn_mod_lowercase() { core_exit.sh fi fi - done < <(find "${extractdir}" -depth -name '*[[:upper:]]*') + done < <(find "${extractdest}" -depth -name '*[[:upper:]]*') fn_print_ok_eol_nl fi } @@ -73,7 +73,7 @@ fn_mod_create_filelist() { echo -en "building ${modcommand}-files.txt..." fn_sleep_time # ${modsdir}/${modcommand}-files.txt. - find "${extractdir}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt" + find "${extractdest}" -mindepth 1 -printf '%P\n' > "${modsdir}/${modcommand}-files.txt" local exitcode=$? if [ "${exitcode}" != 0 ]; then fn_print_fail_eol_nl @@ -93,7 +93,7 @@ fn_mod_create_filelist() { fn_mod_copy_destination() { echo -en "copying ${modprettyname} to ${modinstalldir}..." fn_sleep_time - cp -Rf "${extractdir}/." "${modinstalldir}/" + cp -Rf "${extractdest}/." "${modinstalldir}/" local exitcode=$? if [ "${exitcode}" != 0 ]; then fn_print_fail_eol_nl diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 4c5271a39..6eee91700 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -7,18 +7,9 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_ts3_dl() { - ts3latestdata=$(curl -s "https://www.${remotelocation}/versions/server.json" | jq '.linux') - if [ "${ts3arch}" == "amd64" ]; then - remotebuildurl=$(echo -e "${ts3latestdata}" | jq -r '.x86_64.mirrors."teamspeak.com"') - remotehash=$(echo -e "${ts3latestdata}" | jq -r '.x86_64.checksum') - elif [ "${ts3arch}" == "x86" ]; then - remotebuildurl=$(echo -e "${ts3latestdata}" | jq -r '.x86.mirrors."teamspeak.com"') - remotehash=$(echo -e "${ts3latestdata}" | jq -r '.x86.checksum') - fi - remotefile=$(basename "${remotebuildurl}") - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotefile}" "" "norun" "noforce" "${remotehash}" - fn_dl_extract "${tmpdir}" "${remotefile}" "${tmpdir}" +fn_update_dl() { + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "${remotebuildhash}" + fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${tmpdir}" echo -e "copying to ${serverfiles}...\c" cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}" local exitcode=$? @@ -34,7 +25,7 @@ fn_update_ts3_dl() { fi } -fn_update_ts3_localbuild() { +fn_update_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses log file to get local build. @@ -50,19 +41,24 @@ fn_update_ts3_localbuild() { fi } -fn_update_ts3_remotebuild() { +fn_update_remotebuild() { # Gets remote build info. - ts3latestdata=$(curl -s "https://www.${remotelocation}/versions/server.json" | jq '.linux') + apiurl="https://www.teamspeak.com/versions/server.json" + remotebuildresponse=$(curl -s "${apiurl}") if [ "${ts3arch}" == "amd64" ]; then - remotebuild=$(echo -e "${ts3latestdata}" | jq -r '.x86_64.version') + remotebuildurl=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86_64.mirrors."teamspeak.com"') + remotebuildhash=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86_64.checksum') elif [ "${ts3arch}" == "x86" ]; then - remotebuild=$(echo -e "${ts3latestdata}" | jq -r '.x86.version') + remotebuildurl=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86.mirrors."teamspeak.com"') + remotebuildhash=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86.checksum') fi + remotebuildversion=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86_64.version') + remotebuildfilename=$(basename "${remotebuildurl}") 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 @@ -72,7 +68,7 @@ fn_update_ts3_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 @@ -80,18 +76,29 @@ fn_update_ts3_remotebuild() { fi } -fn_update_ts3_compare() { +fn_update_compare() { fn_print_dots "Checking for update: ${remotelocation}" - if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then + if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" echo -en "\n" echo -e "Update available" echo -e "* Local build: ${red}${localbuild}${default}" - echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -e "* Remote build: ${green}${remotebuildversion}${default}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* apiurl: ${apiurl}" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi + echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild}" - fn_script_log_info "Remote build: ${remotebuild}" - fn_script_log_info "${localbuild} > ${remotebuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + fn_script_log_info "${localbuild} > ${remotebuildversion}" if [ "${commandname}" == "UPDATE" ]; then unset updateonstart @@ -99,7 +106,7 @@ fn_update_ts3_compare() { # If server stopped. if [ "${status}" == "0" ]; then exitbypass=1 - fn_update_ts3_dl + fn_update_dl if [ "${localbuild}" == "0" ]; then exitbypass=1 command_start.sh @@ -116,7 +123,7 @@ fn_update_ts3_compare() { command_stop.sh fn_firstcommand_reset exitbypass=1 - fn_update_ts3_dl + fn_update_dl exitbypass=1 command_start.sh fn_firstcommand_reset @@ -133,11 +140,24 @@ fn_update_ts3_compare() { echo -en "\n" echo -e "No update available" echo -e "* Local build: ${green}${localbuild}${default}" - echo -e "* Remote build: ${green}${remotebuild}${default}" + echo -e "* Remote build: ${green}${remotebuildversion}${default}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild}" - fn_script_log_info "Remote build: ${remotebuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + if [ -n "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* apiurl: ${apiurl}" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi fi } @@ -157,13 +177,13 @@ fi remotelocation="teamspeak.com" if [ "${firstcommandname}" == "INSTALL" ]; then - fn_update_ts3_remotebuild - fn_update_ts3_dl + fn_update_remotebuild + fn_update_dl else fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" - fn_update_ts3_localbuild - fn_update_ts3_remotebuild - fn_update_ts3_compare + fn_update_localbuild + fn_update_remotebuild + fn_update_compare fi diff --git a/lgsm/functions/update_ut99.sh b/lgsm/functions/update_ut99.sh index 1d8e38964..271423e3f 100644 --- a/lgsm/functions/update_ut99.sh +++ b/lgsm/functions/update_ut99.sh @@ -7,13 +7,15 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_ut99_dl() { - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "nohash" +fn_update_dl() { + # Download and extract files to serverfiles + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" echo "${remotebuildversion}" > "${serverfiles}/build.txt" + fn_clear_tmp } -fn_update_ut99_localbuild() { +fn_update_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses build file to get local build. @@ -29,13 +31,14 @@ fn_update_ut99_localbuild() { fi } -fn_update_ut99_remotebuild() { +fn_update_remotebuild() { # Get remote build info. apiurl="https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest" remotebuildresponse=$(curl -s "${apiurl}") remotebuildfilename=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .name') remotebuildurl=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .browser_download_url') remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '.tag_name') + if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuildversion variable has been set. @@ -57,7 +60,7 @@ fn_update_ut99_remotebuild() { fi } -fn_update_ut99_compare() { +fn_update_compare() { fn_print_dots "Checking for update: ${remotelocation}" if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" @@ -65,11 +68,9 @@ fn_update_ut99_compare() { echo -e "Update available" echo -e "* Local build: ${red}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuildversion}${default}" - echo -en "\n" - fn_script_log_info "Update available" - fn_script_log_info "Local build: ${localbuild}" - fn_script_log_info "Remote build: ${remotebuildversion}" - fn_script_log_info "${localbuild} > ${remotebuildversion}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi if [ -f "${rootdir}/.dev-debug" ]; then echo -e "Remote build info" echo -e "* apiurl: ${apiurl}" @@ -77,13 +78,18 @@ fn_update_ut99_compare() { echo -e "* remotebuildurl: ${remotebuildurl}" echo -e "* remotebuildversion: ${remotebuildversion}" fi + echo -en "\n" + fn_script_log_info "Update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + fn_script_log_info "${localbuild} > ${remotebuildversion}" if [ "${commandname}" == "UPDATE" ]; then unset updateonstart check_status.sh # If server stopped. if [ "${status}" == "0" ]; then - fn_update_ut99_dl + fn_update_dl if [ "${localbuild}" == "0" ]; then exitbypass=1 command_start.sh @@ -100,7 +106,7 @@ fn_update_ut99_compare() { command_stop.sh fn_firstcommand_reset exitbypass=1 - fn_update_ut99_dl + fn_update_dl exitbypass=1 command_start.sh fn_firstcommand_reset @@ -118,10 +124,16 @@ fn_update_ut99_compare() { echo -e "No update available" echo -e "* Local build: ${green}${localbuild}${default}" echo -e "* Remote build: ${green}${remotebuildversion}${default}" + if [ -n "${branch}" ]; then + echo -e "* Branch: ${branch}" + fi echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild}" fn_script_log_info "Remote build: ${remotebuildversion}" + if [ -n "${branch}" ]; then + fn_script_log_info "Branch: ${branch}" + fi if [ -f "${rootdir}/.dev-debug" ]; then echo -e "Remote build info" echo -e "* apiurl: ${apiurl}" @@ -136,13 +148,13 @@ fn_update_ut99_compare() { remotelocation="github.com" if [ "${firstcommandname}" == "INSTALL" ]; then - fn_update_ut99_remotebuild - fn_update_ut99_dl + fn_update_remotebuild + fn_update_dl else fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" - fn_update_ut99_localbuild - fn_update_ut99_remotebuild - fn_update_ut99_compare + fn_update_localbuild + fn_update_remotebuild + fn_update_compare fi diff --git a/lgsm/functions/update_vintagestory.sh b/lgsm/functions/update_vintagestory.sh index d6eae2c6a..5e7bbae03 100755 --- a/lgsm/functions/update_vintagestory.sh +++ b/lgsm/functions/update_vintagestory.sh @@ -7,14 +7,14 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_update_vs_dl() { +fn_update_dl() { # Download and extract files to serverfiles - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildmd5}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" fn_clear_tmp } -fn_update_vs_localbuild() { +fn_update_localbuild() { # Gets local build info. fn_print_dots "Checking local build: ${remotelocation}" # Uses executable to get local build. @@ -31,7 +31,7 @@ fn_update_vs_localbuild() { fi } -fn_update_vs_remotebuild() { +fn_update_remotebuild() { # Get remote build info. apiurl="http://api.vintagestory.at/stable-unstable.json" remotebuildresponse=$(curl -s "${apiurl}") @@ -42,7 +42,7 @@ fn_update_vs_remotebuild() { fi remotebuildfilename=$(echo "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].server.filename') remotebuildurl=$(echo "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].server.urls.cdn') - remotebuildmd5=$(echo "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].server.md5') + remotebuildhash=$(echo "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].server.md5') if [ "${firstcommandname}" != "INSTALL" ]; then fn_print_dots "Checking remote build: ${remotelocation}" @@ -65,7 +65,7 @@ fn_update_vs_remotebuild() { fi } -fn_update_vs_compare() { +fn_update_compare() { fn_print_dots "Checking for update: ${remotelocation}" if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then fn_print_ok_nl "Checking for update: ${remotelocation}" @@ -76,6 +76,13 @@ fn_update_vs_compare() { if [ -n "${branch}" ]; then echo -e "* Branch: ${branch}" fi + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* apiurl: ${apiurl}" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild}" @@ -87,8 +94,7 @@ fn_update_vs_compare() { check_status.sh # If server stopped. if [ "${status}" == "0" ]; then - exitbypass=1 - fn_update_vs_dl + fn_update_dl if [ "${localbuild}" == "0" ]; then exitbypass=1 command_start.sh @@ -105,7 +111,7 @@ fn_update_vs_compare() { command_stop.sh fn_firstcommand_reset exitbypass=1 - fn_update_vs_dl + fn_update_dl exitbypass=1 command_start.sh fn_firstcommand_reset @@ -133,6 +139,13 @@ fn_update_vs_compare() { if [ -n "${branch}" ]; then fn_script_log_info "Branch: ${branch}" fi + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* apiurl: ${apiurl}" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi fi } @@ -140,13 +153,13 @@ fn_update_vs_compare() { remotelocation="vintagestory.at" if [ "${firstcommandname}" == "INSTALL" ]; then - fn_update_vs_remotebuild - fn_update_vs_dl + fn_update_remotebuild + fn_update_dl else fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" - fn_update_vs_localbuild - fn_update_vs_remotebuild - fn_update_vs_compare + fn_update_localbuild + fn_update_remotebuild + fn_update_compare fi