From 46d004c7449b706a81ba207f40adcb6c27d3e2cc Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 27 Sep 2023 11:37:34 +0100 Subject: [PATCH] refactor: improve readability and consistency in code - Updated the echo statement to include formatting for script name - Added bold formatting to EULA acceptance message - Removed unnecessary line breaks and added italic formatting to EULA URL - Refactored code to remove duplicate calls to install_eula.sh --- lgsm/modules/command_update_linuxgsm.sh | 2 +- lgsm/modules/install_eula.sh | 7 ++++--- lgsm/modules/install_server_files.sh | 9 ++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lgsm/modules/command_update_linuxgsm.sh b/lgsm/modules/command_update_linuxgsm.sh index bde85fde5..3bdffea3f 100644 --- a/lgsm/modules/command_update_linuxgsm.sh +++ b/lgsm/modules/command_update_linuxgsm.sh @@ -68,7 +68,7 @@ fi # Check gameserver.sh # Compare gameserver.sh against linuxgsm.sh in the tmp dir. # Ignoring server specific vars. -echo -en "checking script [ ${selfname} ]\c" +echo -en "checking script [ ${italic}${selfname}${default} ]\c" fn_script_log_info "Checking ${selfname}" script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}")) if [ "${script_diff}" != "" ]; then diff --git a/lgsm/modules/install_eula.sh b/lgsm/modules/install_eula.sh index d70ca7d31..e74a911af 100644 --- a/lgsm/modules/install_eula.sh +++ b/lgsm/modules/install_eula.sh @@ -16,11 +16,12 @@ elif [ "${shortname}" == "ut" ]; then fi echo -e "" -echo -e "${lightyellow}Accept ${gamename} EULA${default}" -echo -e "=================================" +echo -e "${bold}${lightyellow}Accept ${gamename} EULA${default}" +echo -e "${bold}=================================${default}" fn_sleep_time echo -e "You are required to accept the EULA:" -echo -e "${eulaurl}" +echo -e "" +echo -e "${italic}${eulaurl}${default}" echo -e "" if [ -z "${autoinstall}" ]; then echo -e "By continuing you are indicating your agreement to the EULA." diff --git a/lgsm/modules/install_server_files.sh b/lgsm/modules/install_server_files.sh index 70eb808b0..b7af5c8ed 100644 --- a/lgsm/modules/install_server_files.sh +++ b/lgsm/modules/install_server_files.sh @@ -205,6 +205,10 @@ fn_install_server_files() { fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}" } +if [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "ut" ]; then + install_eula.sh +fi + echo -e "" echo -e "${lightyellow}Installing ${gamename} Server${default}" echo -e "=================================" @@ -220,12 +224,10 @@ fi if [ "${shortname}" == "ts3" ]; then update_ts3.sh elif [ "${shortname}" == "mc" ]; then - install_eula.sh update_mc.sh elif [ "${shortname}" == "mcb" ]; then update_mcb.sh elif [ "${shortname}" == "pmc" ]; then - install_eula.sh update_pmc.sh elif [ "${shortname}" == "wmc" ] || [ "${shortname}" == "vpmc" ]; then update_pmc.sh @@ -242,9 +244,6 @@ elif [ "${shortname}" == "ut99" ]; then fn_install_server_files update_ut99.sh elif [ -z "${appid}" ] || [ "${shortname}" == "ahl" ] || [ "${shortname}" == "bb" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "sfc" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "vs" ] || [ "${shortname}" == "zmr" ]; then - if [ "${shortname}" == "ut" ]; then - install_eula.sh - fi fn_install_server_files fi