From 390fc2326523bf639966b6874ac5f995a8d285cd Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 4 Apr 2020 21:56:36 +0100 Subject: [PATCH] fix(validate): resolve validate not functioning for non branch (#2802) --- lgsm/functions/command_validate.sh | 16 +++++++-- lgsm/functions/info_messages.sh | 2 +- lgsm/functions/install_server_files.sh | 47 ++++++++++++++++++++------ lgsm/functions/update_steamcmd.sh | 16 +++++++-- 4 files changed, 64 insertions(+), 17 deletions(-) diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 6c0684a3b..c48b7e16a 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -25,17 +25,27 @@ fn_validate(){ if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi - # Detects if unbuffer command is available for 32 bit distributions only. + # Detects if unbuffer command is available, for 32 bit distributions only. info_distro.sh if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then unbuffer="stdbuf -i0 -o0 -e0" fi + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. if [ "${appid}" == "90" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" - else + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_info_print 70 +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}" + fi + # All other servers. + elif [ -n "${branch}" ]; then ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit | tee -a "${lgsmlog}" fi + exitcode=$? fn_print_dots "Validating server: SteamCMD" if [ "${exitcode}" != "0" ]; then diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index 8f27ff06a..87d66fb5e 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -186,7 +186,7 @@ fn_info_message_gameserver(){ fi # Branch - if [ "${branch}" ]; then + if [ -n "${branch}" ]; then echo -e "${lightblue}Branch:\t${default}${branch}" fi diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index d4a46718b..3ee515dbc 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -105,19 +105,40 @@ fn_install_server_files_steamcmd(){ fi if [ "${counter}" -le "4" ]; then + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. if [ "${appid}" == "90" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit - local exitcode=$? + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit + fi + # All other servers. else - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit - local exitcode=$? + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update -beta "${branch}" +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit + fi fi + local exitcode=$? elif [ "${counter}" -ge "5" ]; then - if [ "${engine}" == "goldsrc" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. + if [ "${appid}" == "90" ]; then + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" validate +quit + fi local exitcode=$? + # All other servers. else - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" validate +quit + fi local exitcode=$? fi fi @@ -128,14 +149,18 @@ fn_install_server_files_steamcmd(){ fi done - # GoldSrc servers commonly fail to download all the server files required. + # GoldSrc (appid 90) servers commonly fail to download all the server files required. # Validating a few of times may reduce the chance of this issue. - if [ "${engine}" == "goldsrc" ]; then - fn_print_information_nl "GoldSrc servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue." + if [ "${appid}" == "90" ]; then + fn_print_information_nl "GoldSrc servers commonly fail to download all the server files required. Validating a few of times may reduce the chance of this issue." counter="0" while [ "${counter}" -le "4" ]; do counter=$((counter+1)) - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" validate +quit + fi local exitcode=$? done fi diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 3715ff993..8e4918494 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -18,10 +18,22 @@ fn_update_steamcmd_dl(){ if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi + + # If GoldSrc (appid 90) servers. GoldSrc (appid 90) require extra commands. if [ "${appid}" == "90" ]; then - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + # If using a specific branch. + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" +quit | tee -a "${lgsmlog}" + fi + # All other servers. else - ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + if [ -n "${branch}" ]; then + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + else + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" +quit | tee -a "${lgsmlog}" + fi fi fix.sh }