Browse Source

rename variables

pull/4146/head
Daniel Gibbs 3 years ago
parent
commit
6b378e85c9
  1. 5
      lgsm/functions/update_factorio.sh
  2. 5
      lgsm/functions/update_jediknight2.sh
  3. 5
      lgsm/functions/update_minecraft.sh
  4. 5
      lgsm/functions/update_minecraft_bedrock.sh
  5. 9
      lgsm/functions/update_mta.sh
  6. 5
      lgsm/functions/update_ts3.sh
  7. 28
      lgsm/functions/update_ut99.sh
  8. 9
      lgsm/functions/update_vintagestory.sh

5
lgsm/functions/update_factorio.sh

@ -68,10 +68,7 @@ fn_update_factorio_remotebuild() {
fn_update_factorio_compare() { fn_update_factorio_compare() {
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
# Removes dots so if statement can compare version numbers. if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]')
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n" echo -en "\n"
echo -e "Update available" echo -e "Update available"

5
lgsm/functions/update_jediknight2.sh

@ -65,11 +65,8 @@ fn_update_jk2_remotebuild() {
} }
fn_update_jk2_compare() { fn_update_jk2_compare() {
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n" echo -en "\n"
echo -e "Update available" echo -e "Update available"

5
lgsm/functions/update_minecraft.sh

@ -9,9 +9,9 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_minecraft_dl() { fn_update_minecraft_dl() {
# Generate link to version manifest json. # Generate link to version manifest json.
remotebuildlink=$(curl -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r --arg branch ${branch} --arg mcversion ${remotebuild} '.versions | .[] | select(.type==$branch and .id==$mcversion) | .url') remotebuildurl=$(curl -s "https://launchermeta.${remotelocation}/mc/game/version_manifest.json" | jq -r --arg branch ${branch} --arg mcversion ${remotebuild} '.versions | .[] | select(.type==$branch and .id==$mcversion) | .url')
# Generate link to server.jar # Generate link to server.jar
remotebuildurl=$(curl -s "${remotebuildlink}" | jq -r '.downloads.server.url') remotebuildurl=$(curl -s "${remotebuildurl}" | jq -r '.downloads.server.url')
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "minecraft_server.${remotebuild}.jar" "" "norun" "noforce" "nohash" fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "minecraft_server.${remotebuild}.jar" "" "norun" "noforce" "nohash"
echo -e "copying to ${serverfiles}...\c" echo -e "copying to ${serverfiles}...\c"
@ -82,7 +82,6 @@ fn_update_minecraft_remotebuild() {
} }
fn_update_minecraft_compare() { fn_update_minecraft_compare() {
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"

5
lgsm/functions/update_minecraft_bedrock.sh

@ -78,11 +78,8 @@ fn_update_minecraft_remotebuild() {
} }
fn_update_minecraft_compare() { fn_update_minecraft_compare() {
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n" echo -en "\n"
echo -e "Update available" echo -e "Update available"

9
lgsm/functions/update_mta.sh

@ -67,11 +67,8 @@ fn_update_mta_remotebuild() {
} }
fn_update_mta_compare() { fn_update_mta_compare() {
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then
if [ "${forceupdate}" == "1" ]; then if [ "${forceupdate}" == "1" ]; then
# forceupdate bypasses checks, useful for small build changes # forceupdate bypasses checks, useful for small build changes
mtaupdatestatus="forced" mtaupdatestatus="forced"
@ -89,6 +86,7 @@ fn_update_mta_compare() {
fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "Remote build: ${remotebuild}"
fn_script_log_info "${localbuild} > ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
unset updateonstart unset updateonstart
check_status.sh check_status.sh
# If server stopped. # If server stopped.
@ -118,6 +116,9 @@ fn_update_mta_compare() {
unset exitbypass unset exitbypass
date +%s > "${lockdir}/lastupdate.lock" date +%s > "${lockdir}/lastupdate.lock"
alert="update" alert="update"
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
alert="check-update"
fi
alert.sh alert.sh
else else
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"

5
lgsm/functions/update_ts3.sh

@ -81,11 +81,8 @@ fn_update_ts3_remotebuild() {
} }
fn_update_ts3_compare() { fn_update_ts3_compare() {
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n" echo -en "\n"
echo -e "Update available" echo -e "Update available"

28
lgsm/functions/update_ut99.sh

@ -8,23 +8,12 @@
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_ut99_dl() { fn_update_ut99_dl() {
remotebuildlink=$(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') 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') 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 "${remotebuildlink}" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "nohash" fn_fetch_file "${remotebuildurl}" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "nohash"
fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}"
local exitcode=$? echo "${remotebuild}" > "${serverfiles}/build.txt"
if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "Copying to ${serverfiles}"
fn_clear_tmp
# put version number in version.txt
echo "${remotebuild}" > "${serverfiles}/version.txt"
else
fn_print_fail_eol_nl
fn_script_log_fatal "Copying to ${serverfiles}"
core_exit.sh
fi
} }
fn_update_ut99_localbuild() { fn_update_ut99_localbuild() {
@ -68,11 +57,8 @@ fn_update_ut99_remotebuild() {
} }
fn_update_ut99_compare() { fn_update_ut99_compare() {
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
localbuilddigit=$(echo -e "${localbuild}" | tr -cd '[:digit:]') if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
remotebuilddigit=$(echo -e "${remotebuild}" | tr -cd '[:digit:]')
if [ "${localbuilddigit}" -ne "${remotebuilddigit}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n" echo -en "\n"
echo -e "Update available" echo -e "Update available"
@ -84,6 +70,7 @@ fn_update_ut99_compare() {
fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "Remote build: ${remotebuild}"
fn_script_log_info "${localbuild} > ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
unset updateonstart unset updateonstart
check_status.sh check_status.sh
# If server stopped. # If server stopped.
@ -113,6 +100,9 @@ fn_update_ut99_compare() {
unset exitbypass unset exitbypass
date +%s > "${lockdir}/lastupdate.lock" date +%s > "${lockdir}/lastupdate.lock"
alert="update" alert="update"
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
alert="check-update"
fi
alert.sh alert.sh
else else
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
@ -130,8 +120,6 @@ fn_update_ut99_compare() {
# The location where the builds are checked and downloaded. # The location where the builds are checked and downloaded.
remotelocation="github.com" remotelocation="github.com"
localbuildfile="${serverfiles}/version.txt"
if [ "${firstcommandname}" == "INSTALL" ]; then if [ "${firstcommandname}" == "INSTALL" ]; then
fn_update_ut99_remotebuild fn_update_ut99_remotebuild
fn_update_ut99_dl fn_update_ut99_dl

9
lgsm/functions/update_vintagestory.sh

@ -11,11 +11,11 @@ fn_update_vs_dl() {
# get version info for download # get version info for download
remotebuildresponse=$(curl -s "${apiurl}" | jq --arg version "${remotebuild}" '.[$version].server') remotebuildresponse=$(curl -s "${apiurl}" | jq --arg version "${remotebuild}" '.[$version].server')
remotebuildfile=$(echo -e "${remotebuildresponse}" | jq -r '.filename') remotebuildfile=$(echo -e "${remotebuildresponse}" | jq -r '.filename')
remotebuildlink=$(echo -e "${remotebuildresponse}" | jq -r '.urls.cdn') remotebuildurl=$(echo -e "${remotebuildresponse}" | jq -r '.urls.cdn')
remotebuildmd5=$(echo -e "${remotebuildresponse}" | jq -r '.md5') remotebuildmd5=$(echo -e "${remotebuildresponse}" | jq -r '.md5')
# Download and extract files to serverfiles # Download and extract files to serverfiles
fn_fetch_file "${remotebuildlink}" "" "" "" "${tmpdir}" "${remotebuildfile}" "nochmodx" "norun" "force" "${remotebuildmd5}" fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfile}" "nochmodx" "norun" "force" "${remotebuildmd5}"
fn_dl_extract "${tmpdir}" "${remotebuildfile}" "${serverfiles}" fn_dl_extract "${tmpdir}" "${remotebuildfile}" "${serverfiles}"
fn_clear_tmp fn_clear_tmp
} }
@ -66,7 +66,6 @@ fn_update_vs_remotebuild() {
} }
fn_update_vs_compare() { fn_update_vs_compare() {
# Removes dots so if statement can compare version numbers.
fn_print_dots "Checking for update: ${remotelocation}" fn_print_dots "Checking for update: ${remotelocation}"
if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then if [ "${localbuild}" != "${remotebuild}" ] || [ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"
@ -83,6 +82,7 @@ fn_update_vs_compare() {
fn_script_log_info "Remote build: ${remotebuild}" fn_script_log_info "Remote build: ${remotebuild}"
fn_script_log_info "${localbuild} > ${remotebuild}" fn_script_log_info "${localbuild} > ${remotebuild}"
if [ "${commandname}" == "UPDATE" ]; then
unset updateonstart unset updateonstart
check_status.sh check_status.sh
# If server stopped. # If server stopped.
@ -112,6 +112,9 @@ fn_update_vs_compare() {
unset exitbypass unset exitbypass
date +%s > "${lockdir}/lastupdate.lock" date +%s > "${lockdir}/lastupdate.lock"
alert="update" alert="update"
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
alert="check-update"
fi
alert.sh alert.sh
else else
fn_print_ok_nl "Checking for update: ${remotelocation}" fn_print_ok_nl "Checking for update: ${remotelocation}"

Loading…
Cancel
Save