Browse Source

Refactor remote build version handling across multiple modules

- Updated variable names from 'remotebuildversion' to 'remotebuild' for consistency.
- Adjusted logic to check for remote build availability using the new variable name.
- Modified output messages to reflect the change in variable naming.
- Ensured all modules (update_mc.sh, update_mcb.sh, update_mta.sh, update_pmc.sh, update_ts3.sh, update_ut99.sh, update_vints.sh, update_xnt.sh) are aligned with the new naming convention for better readability and maintainability.
4696-bug-discord-alert-on-update-uses-the-old-version-not-the-new-one
Daniel Gibbs 1 week ago
parent
commit
bdfc6e5bd1
Failed to extract signature
  1. 31
      lgsm/modules/alert.sh
  2. 20
      lgsm/modules/core_steamcmd.sh
  3. 62
      lgsm/modules/update_fctr.sh
  4. 24
      lgsm/modules/update_jk2.sh
  5. 32
      lgsm/modules/update_mc.sh
  6. 32
      lgsm/modules/update_mcb.sh
  7. 24
      lgsm/modules/update_mta.sh
  8. 26
      lgsm/modules/update_pmc.sh
  9. 24
      lgsm/modules/update_ts3.sh
  10. 26
      lgsm/modules/update_ut99.sh
  11. 32
      lgsm/modules/update_vints.sh
  12. 25
      lgsm/modules/update_xnt.sh

31
lgsm/modules/alert.sh

@ -97,16 +97,37 @@ fn_alert_monitor_query() {
# Update alerts
fn_alert_update() {
fn_script_log_info "Sending alert: ${selfname} has received a game server update: ${localbuild}"
# If previousbuild is set show transition, else fallback to single version.
if [ -n "${previousbuild:-}" ] && [ -n "${localbuild:-}" ]; then
fn_script_log_info "Sending alert: ${selfname} updated ${previousbuild} -> ${localbuild}"
alertmessage="${selfname} has been updated: ${previousbuild} -> ${localbuild}."
else
fn_script_log_info "Sending alert: ${selfname} has received a game server update: ${localbuild}"
alertmessage="${selfname} has received a game server update: ${localbuild}."
fi
alertaction="Updated"
alertemoji="🎉"
alertsound="1"
alertmessage="${selfname} has received a game server update: ${localbuild}."
# Green
alertcolourhex="#00cd00"
alertcolourdec="52480"
}
# Update failure alert
fn_alert_update_failed() {
# Expect updatefailureexpected (target version) and updatefailuregot (actual localbuild) if set
local expected="${updatefailureexpected:-${remotebuild:-unknown}}"
local got="${updatefailuregot:-${localbuild:-unknown}}"
fn_script_log_error "Sending alert: ${selfname} update failed expected ${expected} got ${got}"
alertaction="Update Failed"
alertemoji="❌"
alertsound="2"
alertmessage="${selfname} update failed. Expected ${expected} but is still ${got}. Manual intervention required."
# Red
alertcolourhex="#cd0000"
alertcolourdec="13434880"
}
fn_alert_update_request() {
fn_script_log_info "Sending alert: ${selfname} has requested an update and needs to be restarted."
alertaction="Updating"
@ -119,11 +140,11 @@ fn_alert_update_request() {
}
fn_alert_check_update() {
fn_script_log_info "Sending alert: ${gamename} update available: ${remotebuildversion}"
fn_script_log_info "Sending alert: ${gamename} update available: ${localbuild} -> ${remotebuild}"
alertaction="Update available"
alertemoji="🎉"
alertsound="1"
alertmessage="${gamename} update available: ${remotebuildversion}"
alertmessage="${gamename} update available: ${localbuild} -> ${remotebuild}"
# Blue
alertcolourhex="#1e90ff"
alertcolourdec="2003199"
@ -210,6 +231,8 @@ elif [ "${alert}" == "test" ]; then
fn_alert_test
elif [ "${alert}" == "update" ]; then
fn_alert_update
elif [ "${alert}" == "update-failed" ]; then
fn_alert_update_failed
elif [ "${alert}" == "update-request" ]; then
fn_alert_update_request
elif [ "${alert}" == "check-update" ]; then

20
lgsm/modules/core_steamcmd.sh

@ -185,12 +185,12 @@ fn_update_steamcmd_remotebuild() {
fi
# password for branch not needed to check the buildid
remotebuildversion=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_request "${appid}" +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed -e '/"branches"/,/^}/!d' | sed -n "/\"${branch}\"/,/}/p" | grep -m 1 buildid | tr -cd '[:digit:]')
remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_request "${appid}" +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed -e '/"branches"/,/^}/!d' | sed -n "/\"${branch}\"/,/}/p" | grep -m 1 buildid | tr -cd '[:digit:]')
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -200,7 +200,7 @@ fn_update_steamcmd_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -211,14 +211,14 @@ fn_update_steamcmd_remotebuild() {
fn_update_steamcmd_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -229,14 +229,14 @@ fn_update_steamcmd_compare() {
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
if [ -n "${betapassword}" ]; then
fn_script_log_info "Branch password: ${betapassword}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -268,7 +268,7 @@ fn_update_steamcmd_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -279,7 +279,7 @@ fn_update_steamcmd_compare() {
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi

62
lgsm/modules/update_fctr.sh

@ -10,25 +10,32 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_dl() {
# 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_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "${serverfiles}" "factorio"
fn_clear_tmp
}
fn_update_localbuild() {
# Gets local build info.
fn_print_dots "Checking local build: ${remotelocation}"
# Optional arg1: 'silent' to suppress user-facing output
local mode="${1:-}"
if [ "${mode}" != "silent" ]; then
fn_print_dots "Checking local build: ${remotelocation}"
fi
# Uses executable to get local build.
if [ -d "${executabledir}" ]; then
cd "${executabledir}" || exit
localbuild=$(${executable} --version | grep -m 1 "Version:" | awk '{print $2}')
fi
if [ -z "${localbuild}" ]; then
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
if [ "${mode}" != "silent" ]; then
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
fi
fn_script_log_error "Missing local build info"
fn_script_log_error "Set localbuild to 0"
localbuild="0"
else
fn_print_ok "Checking local build: ${remotelocation}"
if [ "${mode}" != "silent" ]; then
fn_print_ok "Checking local build: ${remotelocation}"
fi
fn_script_log_pass "Checking local build"
fi
}
@ -37,14 +44,14 @@ fn_update_remotebuild() {
# Gets remote build info.
apiurl="https://factorio.com/get-download/${branch}/headless/${factorioarch}"
remotebuildresponse=$(curl -s "${apiurl}")
remotebuildversion=$(echo "${remotebuildresponse}" | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1)
remotebuild=$(echo "${remotebuildresponse}" | grep -o '[0-9]\.[0-9]\{1,\}\.[0-9]\{1,\}' | head -1)
remotebuildurl="https://factorio.com/get-download/${branch}/headless/${factorioarch}"
remotebuildfilename="factorio_headless_${factorioarch}-${remotebuildversion}.tar.xz"
remotebuildfilename="factorio_headless_${factorioarch}-${remotebuild}.tar.xz"
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -54,7 +61,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -65,14 +72,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -81,18 +88,20 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\n"
fn_script_log_info "Update available"
fn_script_log_info "Local build: ${localbuild} ${factorioarch}"
fn_script_log_info "Remote build: ${remotebuildversion} ${factorioarch}"
fn_script_log_info "Remote build: ${remotebuild} ${factorioarch}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
# Keep track of the build before updating for alert purposes.
previousbuild="${localbuild}"
date +%s > "${lockdir:?}/last-updated.lock"
unset updateonstart
check_status.sh
@ -120,6 +129,23 @@ fn_update_compare() {
command_start.sh
fn_firstcommand_reset
fi
# Refresh local build value after update (silent) so alerts show new version.
fn_update_localbuild silent
# Verify the update applied correctly unless forced update to same version.
if [ "${localbuild}" != "${remotebuild}" ]; then
# If forced update and version unchanged treat as acceptable; otherwise failure.
if [ "${forceupdate}" != "1" ] || [ "${previousbuild}" = "${localbuild}" ]; then
fn_script_log_error "Update verification failed: expected ${remotebuild}, got ${localbuild}"
fn_print_fail_nl "Update verification failed: expected ${remotebuild}, got ${localbuild}"
updatefailureexpected="${remotebuild}"
updatefailuregot="${localbuild}"
alert="update-failed"
alert.sh
core_exit.sh
fi
else
fn_script_log_pass "Update verification success: ${previousbuild} -> ${localbuild}"
fi
unset exitbypass
alert="update"
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
@ -131,14 +157,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild} ${factorioarch}"
fn_script_log_info "Remote build: ${remotebuildversion} ${factorioarch}"
fn_script_log_info "Remote build: ${remotebuild} ${factorioarch}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -147,7 +173,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

24
lgsm/modules/update_jk2.sh

@ -36,12 +36,12 @@ fn_update_remotebuild() {
remotebuildresponse=$(curl -s "${apiurl}")
remotebuildfilename=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("dedicated.zip")) | .name')
remotebuildurl=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("dedicated.zip")) | .browser_download_url')
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '.tag_name')
remotebuild=$(echo "${remotebuildresponse}" | jq -r '.tag_name')
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -51,7 +51,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -62,14 +62,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -78,16 +78,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -128,14 +128,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -144,7 +144,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

32
lgsm/modules/update_mc.sh

@ -39,24 +39,24 @@ fn_update_remotebuild() {
remotebuildresponse=$(curl -s "${apiurl}")
# Latest release.
if [ "${branch}" == "release" ] && [ "${mcversion}" == "latest" ]; then
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '.latest.release')
remotebuild=$(echo "${remotebuildresponse}" | jq -r '.latest.release')
# Latest snapshot.
elif [ "${branch}" == "snapshot" ] && [ "${mcversion}" == "latest" ]; then
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '.latest.snapshot')
remotebuild=$(echo "${remotebuildresponse}" | jq -r '.latest.snapshot')
# Specific release/snapshot.
else
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r --arg branch "${branch}" --arg mcversion "${mcversion}" '.versions | .[] | select(.type==$branch and .id==$mcversion) | .id')
remotebuild=$(echo "${remotebuildresponse}" | jq -r --arg branch "${branch}" --arg mcversion "${mcversion}" '.versions | .[] | select(.type==$branch and .id==$mcversion) | .id')
fi
remotebuildfilename="minecraft_server.${remotebuildversion}.jar"
remotebuildfilename="minecraft_server.${remotebuild}.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')
remotebuildmanifest=$(echo "${remotebuildresponse}" | jq -r --arg branch "${branch}" --arg mcversion "${remotebuild}" '.versions | .[] | select(.type==$branch and .id==$mcversion) | .url')
# Generate link to server.jar
remotebuildurl=$(curl -s "${remotebuildmanifest}" | jq -r '.downloads.server.url')
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -66,7 +66,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -77,14 +77,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -93,16 +93,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -143,14 +143,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -159,7 +159,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

32
lgsm/modules/update_mcb.sh

@ -8,12 +8,12 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_dl() {
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "bedrock_server.${remotebuildversion}.zip" "nochmodx" "norun" "noforce" "nohash"
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "bedrock_server.${remotebuild}.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}"
unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "server.properties" -d "${serverfiles}"
else
unzip -oq "${tmpdir}/bedrock_server.${remotebuildversion}.zip" -x "permissions.json" "server.properties" "allowlist.json" -d "${serverfiles}"
unzip -oq "${tmpdir}/bedrock_server.${remotebuild}.zip" -x "permissions.json" "server.properties" "allowlist.json" -d "${serverfiles}"
fi
exitcode=$?
if [ "${exitcode}" -ne 0 ]; then
@ -61,13 +61,13 @@ fn_update_remotebuild() {
else
remotebuildurl=$(echo "${remotebuildresponse}" | jq -r 'select(.downloadType == "serverBedrockLinux") | .downloadUrl')
fi
remotebuildversion=$(echo "${remotebuildurl}" | grep -Eo "[.0-9]+[0-9]")
remotebuildfilename="bedrock-server-${remotebuildversion}.zip"
remotebuild=$(echo "${remotebuildurl}" | grep -Eo "[.0-9]+[0-9]")
remotebuildfilename="bedrock-server-${remotebuild}.zip"
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -77,7 +77,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -88,14 +88,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -104,16 +104,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -154,14 +154,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -170,7 +170,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

24
lgsm/modules/update_mta.sh

@ -39,11 +39,11 @@ fn_update_remotebuild() {
remotebuildresponse=$(curl -s "${apiurl}")
remotebuildfilename="multitheftauto_linux_x64.tar.gz"
remotebuildurl="http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz"
remotebuildversion="${remotebuildresponse}"
remotebuild="${remotebuildresponse}"
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -53,7 +53,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -64,7 +64,7 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
if [ "${forceupdate}" == "1" ]; then
@ -77,7 +77,7 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -86,16 +86,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -136,14 +136,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -152,7 +152,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

26
lgsm/modules/update_pmc.sh

@ -11,7 +11,7 @@ fn_update_dl() {
# 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"
echo "${remotebuild}" > "${serverfiles}/build.txt"
fn_clear_tmp
}
@ -61,12 +61,12 @@ fn_update_remotebuild() {
remotebuildhash=$(echo "${remotebuildresponseversion}" | jq -r '.downloads.application.sha256')
remotebuildurl="${apiurl}/${paperproject}/versions/${remotebuildmcversion}/builds/${remotebuildpaperversion}/downloads/${remotebuildfilename}"
# Combines Minecraft: Java Edition version and paper build. e.g 1.16.5-456
remotebuildversion="${remotebuildmcversion}-${remotebuildpaperversion}"
remotebuild="${remotebuildmcversion}-${remotebuildpaperversion}"
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -76,7 +76,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -87,14 +87,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -103,16 +103,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -153,14 +153,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -169,7 +169,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

24
lgsm/modules/update_ts3.sh

@ -43,12 +43,12 @@ fn_update_remotebuild() {
remotebuildhash=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86.checksum')
fi
remotebuildfilename=$(basename "${remotebuildurl}")
remotebuildversion=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86_64.version')
remotebuild=$(echo -e "${remotebuildresponse}" | jq -r '.linux.x86_64.version')
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -58,7 +58,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -69,14 +69,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -85,16 +85,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -135,14 +135,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -151,7 +151,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

26
lgsm/modules/update_ut99.sh

@ -11,7 +11,7 @@ fn_update_dl() {
# 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"
echo "${remotebuild}" > "${serverfiles}/build.txt"
fn_clear_tmp
}
@ -37,12 +37,12 @@ fn_update_remotebuild() {
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')
remotebuild=$(echo "${remotebuildresponse}" | jq -r '.tag_name')
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -52,7 +52,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -63,14 +63,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -79,16 +79,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -129,14 +129,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -145,7 +145,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

32
lgsm/modules/update_vints.sh

@ -39,18 +39,18 @@ fn_update_remotebuild() {
apiurl="http://api.vintagestory.at/stable-unstable.json"
remotebuildresponse=$(curl -s "${apiurl}")
if [ "${branch}" == "stable" ]; then
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '[ to_entries[] ] | .[].key' | grep -Ev "\-rc|\-pre" | sort -r -V | head -1)
remotebuild=$(echo "${remotebuildresponse}" | jq -r '[ to_entries[] ] | .[].key' | grep -Ev "\-rc|\-pre" | sort -r -V | head -1)
else
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '[ to_entries[] ] | .[].key' | grep -E "\-rc|\-pre" | sort -r -V | head -1)
remotebuild=$(echo "${remotebuildresponse}" | jq -r '[ to_entries[] ] | .[].key' | grep -E "\-rc|\-pre" | sort -r -V | head -1)
fi
remotebuildfilename=$(echo "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].linuxserver.filename')
remotebuildurl=$(echo "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].linuxserver.urls.cdn')
remotebuildhash=$(echo "${remotebuildresponse}" | jq --arg remotebuildversion "${remotebuildversion}" -r '.[$remotebuildversion].linuxserver.md5')
remotebuildfilename=$(echo "${remotebuildresponse}" | jq --arg remotebuild "${remotebuild}" -r '.[$remotebuild].linuxserver.filename')
remotebuildurl=$(echo "${remotebuildresponse}" | jq --arg remotebuild "${remotebuild}" -r '.[$remotebuild].linuxserver.urls.cdn')
remotebuildhash=$(echo "${remotebuildresponse}" | jq --arg remotebuild "${remotebuild}" -r '.[$remotebuild].linuxserver.md5')
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -60,7 +60,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -71,14 +71,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -87,16 +87,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -137,14 +137,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -153,7 +153,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

25
lgsm/modules/update_xnt.sh

@ -54,13 +54,12 @@ fn_update_remotebuild() {
remotebuildfilename=$(echo "${remotebuildtag}" | tr -d 'v')
remotebuildfilename="${remotebuildfilename}.zip"
remotebuildurl="https://dl.xonotic.org/${remotebuildfilename}"
remotebuildversion="${remotebuildtag}"
remotebuild="${remotebuildtag}"
if [ "${firstcommandname}" != "INSTALL" ]; then
fn_print_dots "Checking remote build: ${remotelocation}"
# Checks if remotebuildversion variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
# Checks if remotebuild variable has been set.
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_fail "Checking remote build: ${remotelocation}"
fn_script_log_fail "Checking remote build"
core_exit.sh
@ -70,7 +69,7 @@ fn_update_remotebuild() {
fi
else
# Checks if remotebuild variable has been set.
if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then
if [ -z "${remotebuild}" ] || [ "${remotebuild}" == "null" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fail "Unable to get remote build"
core_exit.sh
@ -81,14 +80,14 @@ fn_update_remotebuild() {
fn_update_compare() {
fn_print_dots "Checking for update: ${remotelocation}"
# Update has been found or force update.
if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
# Create update lockfile.
date '+%s' > "${lockdir:?}/update.lock"
fn_print_ok_nl "Checking for update: ${remotelocation}"
fn_print "\n"
fn_print_nl "${bold}${underline}Update${default} available"
fn_print_nl "* Local build: ${red}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
@ -97,16 +96,16 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fn_print "\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 "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
fn_script_log_info "${localbuild} > ${remotebuildversion}"
fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
@ -147,14 +146,14 @@ fn_update_compare() {
fn_print "\n"
fn_print_nl "${bold}${underline}No update${default} available"
fn_print_nl "* Local build: ${green}${localbuild}${default}"
fn_print_nl "* Remote build: ${green}${remotebuildversion}${default}"
fn_print_nl "* Remote build: ${green}${remotebuild}${default}"
if [ -n "${branch}" ]; then
fn_print_nl "* Branch: ${branch}"
fi
fn_print "\n"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${remotebuildversion}"
fn_script_log_info "Remote build: ${remotebuild}"
if [ -n "${branch}" ]; then
fn_script_log_info "Branch: ${branch}"
fi
@ -163,7 +162,7 @@ fn_update_compare() {
fn_print_nl "* apiurl: ${apiurl}"
fn_print_nl "* remotebuildfilename: ${remotebuildfilename}"
fn_print_nl "* remotebuildurl: ${remotebuildurl}"
fn_print_nl "* remotebuildversion: ${remotebuildversion}"
fn_print_nl "* remotebuild: ${remotebuild}"
fi
fi
}

Loading…
Cancel
Save