From 57771cfedb6abef5d002466cad8c724b218235bf Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 10 Aug 2020 16:04:54 +0100 Subject: [PATCH] update --- lgsm/functions/update_jediknight2.sh | 34 +++++++++++++--------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/lgsm/functions/update_jediknight2.sh b/lgsm/functions/update_jediknight2.sh index 6f50a37f2..0d06d3092 100644 --- a/lgsm/functions/update_jediknight2.sh +++ b/lgsm/functions/update_jediknight2.sh @@ -43,16 +43,16 @@ fn_update_jk2_localbuild(){ if [ "${status}" == "0" ]; then exitbypass=1 command_start.sh + fn_firstcommand_reset sleep 3 exitbypass=1 command_stop.sh + fn_firstcommand_reset # If server started. else exitbypass=1 command_stop.sh - exitbypass=1 - command_start.sh - sleep 3 + fn_firstcommand_reset fi fi @@ -75,14 +75,14 @@ fn_update_jk2_remotebuild(){ # Gets remote build info. remotebuild=$(curl -s "https://api.github.com/repos/mvdevs/jk2mv/releases/latest" | grep dedicated.zip | tail -1 | awk -F"/" '{ print $8 }') if [ "${installer}" != "1" ]; then - fn_print_dots "Checking for update: ${remotelocation}: checking remote build" + fn_print_dots "Checking remote build: ${remotelocation}" # Checks if remotebuild variable has been set. if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then - fn_print_fail "Checking for update: ${remotelocation}: checking remote build" + fn_print_fail "Checking remote build: ${remotelocation}" fn_script_log_fatal "Checking remote build" core_exit.sh else - fn_print_ok "Checking for update: ${remotelocation}: checking remote build" + fn_print_ok "Checking remote build: ${remotelocation}" fn_script_log_pass "Checking remote build" fi else @@ -98,30 +98,21 @@ fn_update_jk2_remotebuild(){ fn_update_jk2_compare(){ # Removes dots so if statement can compare version numbers. fn_print_dots "Checking for update: ${remotelocation}" - localbuilddigit=$(echo "${localbuild}" | tr -cd '[:digit:]') - remotebuilddigit=$(echo "${remotebuild}" | tr -cd '[:digit:]') + 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}" echo -en "\n" echo -e "Update available" echo -e "* Local build: ${red}${localbuild} ${jk2arch}${default}" echo -e "* Remote build: ${green}${remotebuild} ${jk2arch}${default}" + echo -en "\n" fn_script_log_info "Update available" fn_script_log_info "Local build: ${localbuild} ${jk2arch}" fn_script_log_info "Remote build: ${remotebuild} ${jk2arch}" fn_script_log_info "${localbuild} > ${remotebuild}" - fn_sleep_time - echo -en "\n" - echo -en "applying update.\r" - sleep 1 - echo -en "applying update..\r" - sleep 1 - echo -en "applying update...\r" - sleep 1 - echo -en "\n" unset updateonstart - check_status.sh # If server stopped. if [ "${status}" == "0" ]; then @@ -131,15 +122,20 @@ fn_update_jk2_compare(){ command_start.sh exitbypass=1 command_stop.sh + fn_firstcommand_reset # If server started. else + fn_print_restart_warning exitbypass=1 command_stop.sh + fn_firstcommand_reset exitbypass=1 fn_update_jk2_dl exitbypass=1 command_start.sh + fn_firstcommand_reset fi + date +%s > "${lockdir}/lastupdate.lock" alert="update" alert.sh else @@ -148,6 +144,7 @@ fn_update_jk2_compare(){ echo -e "No update available" echo -e "* Local build: ${green}${localbuild} ${jk2arch}${default}" echo -e "* Remote build: ${green}${remotebuild} ${jk2arch}${default}" + echo -en "\n" fn_script_log_info "No update available" fn_script_log_info "Local build: ${localbuild} ${jk2arch}" fn_script_log_info "Remote build: ${remotebuild} ${jk2arch}" @@ -165,6 +162,7 @@ if [ "${installer}" == "1" ]; then fn_update_jk2_dl else update_steamcmd.sh + fn_print_dots "Checking for update" fn_print_dots "Checking for update: ${remotelocation}" fn_script_log_info "Checking for update: ${remotelocation}" fn_update_jk2_localbuild