From 736e55717f9a789aae783ddf5c74bba5d19ab9bc Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 16 Feb 2020 01:01:23 +0000 Subject: [PATCH 1/8] standardise command if --- lgsm/functions/check_deps.sh | 36 +++++++++++----------- lgsm/functions/command_dev_detect_deps.sh | 4 +-- lgsm/functions/command_dev_detect_glibc.sh | 2 +- lgsm/functions/command_fastdl.sh | 2 +- lgsm/functions/command_monitor.sh | 2 +- lgsm/functions/command_stop.sh | 2 +- lgsm/functions/command_validate.sh | 2 +- lgsm/functions/core_dl.sh | 2 +- lgsm/functions/info_distro.sh | 10 +++--- lgsm/functions/info_stats.sh | 2 +- lgsm/functions/install_server_files.sh | 2 +- lgsm/functions/query_gamedig.sh | 2 +- lgsm/functions/update_steamcmd.sh | 2 +- linuxgsm.sh | 4 +-- tests/tests_fctrserver.sh | 4 +-- tests/tests_jc2server.sh | 2 +- tests/tests_mcserver.sh | 4 +-- tests/tests_ts3server.sh | 4 +-- 18 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index 5362e73b54..c88f2870ca 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -160,7 +160,7 @@ fn_deps_detector(){ depstatus=1 jquniversemissing=1 elif [ "${deptocheck}" == "mono-complete" ]; then - if [ -n "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then + if [ "$(command -v mono 2>/dev/null)" ]&&[ "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]; then # Mono >= 5.0.0 already installed. depstatus=0 else @@ -168,10 +168,10 @@ fn_deps_detector(){ depstatus=1 monostatus=1 fi - elif [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then dpkg-query -W -f='${Status}' "${deptocheck}" 2>/dev/null | grep -q -P '^install ok installed' depstatus=$? - elif [ -n "$(command -v rpm 2>/dev/null)" ]; then + elif [ "$(command -v rpm 2>/dev/null)" ]; then rpm -q "${deptocheck}" > /dev/null 2>&1 depstatus=$? fi @@ -212,15 +212,15 @@ fn_deps_email(){ array_deps_required+=( exim4 ) elif [ -d /etc/sendmail ]; then array_deps_required+=( sendmail ) - elif [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + elif [ "$(command -v dpkg-query 2>/dev/null)" ]; then array_deps_required+=( mailutils postfix ) - elif [ -n "$(command -v rpm 2>/dev/null)" ]; then + elif [ "$(command -v rpm 2>/dev/null)" ]; then array_deps_required+=( mailx postfix ) fi else - if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + if [ "$(command -v dpkg-query 2>/dev/null)" ]; then array_deps_required+=( mailutils postfix ) - elif [ -n "$(command -v rpm 2>/dev/null)" ]; then + elif [ "$(command -v rpm 2>/dev/null)" ]; then array_deps_required+=( mailx postfix ) fi fi @@ -255,13 +255,13 @@ fn_found_missing_deps(){ echo -en "...\r" sleep 1 echo -en " \r" - if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + if [ "$(command -v dpkg-query 2>/dev/null)" ]; then cmd="sudo dpkg --add-architecture i386; sudo apt update; sudo apt -y install ${array_deps_missing[@]}" eval "${cmd}" - elif [ -n "$(command -v dnf 2>/dev/null)" ]; then + elif [ "$(command -v dnf 2>/dev/null)" ]; then cmd="sudo dnf -y install ${array_deps_missing[@]}" eval "${cmd}" - elif [ -n "$(command -v yum 2>/dev/null)" ]; then + elif [ "$(command -v yum 2>/dev/null)" ]; then cmd="sudo yum -y install ${array_deps_missing[@]}" eval "${cmd}" fi @@ -271,11 +271,11 @@ fn_found_missing_deps(){ echo -e "" fn_print_warning_nl "Manually install dependencies." fn_script_log_warn "Manually install dependencies." - if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + if [ "$(command -v dpkg-query 2>/dev/null)" ]; then echo -e " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}" - elif [ -n "$(command -v dnf 2>/dev/null)" ]; then + elif [ "$(command -v dnf 2>/dev/null)" ]; then echo -e " sudo dnf install ${array_deps_missing[@]}" - elif [ -n "$(command -v yum 2>/dev/null)" ]; then + elif [ "$(command -v yum 2>/dev/null)" ]; then echo -e " sudo yum install ${array_deps_missing[@]}" fi if [ "${steamcmdfail}" ]; then @@ -292,11 +292,11 @@ fn_found_missing_deps(){ echo -e "" fn_print_warning_nl "$(whoami) does not have sudo access. Manually install dependencies." fn_script_log_warn "$(whoami) does not have sudo access. Manually install dependencies." - if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + if [ "$(command -v dpkg-query 2>/dev/null)" ]; then echo -e " sudo dpkg --add-architecture i386; sudo apt update; sudo apt install ${array_deps_missing[@]}" - elif [ -n "$(command -v dnf 2>/dev/null)" ]; then + elif [ "$(command -v dnf 2>/dev/null)" ]; then echo -e " sudo dnf install ${array_deps_missing[@]}" - elif [ -n "$(command -v yum 2>/dev/null)" ]; then + elif [ "$(command -v yum 2>/dev/null)" ]; then echo -e " sudo yum install ${array_deps_missing[@]}" fi if [ "${steamcmdfail}" ]; then @@ -337,7 +337,7 @@ fn_deps_build_debian(){ # LinuxGSM requirements. array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python3 tar bzip2 gzip unzip binutils bc jq ) - if [ -n "$(command -v tmux 2>/dev/null)" ]; then + if [ "$(command -v tmux 2>/dev/null)" ]; then tmuxcheck=1 # Added for users compiling tmux from source to bypass check. else array_deps_required+=( tmux ) @@ -461,7 +461,7 @@ fn_deps_build_redhat(){ fi # All servers except ts3 require tmux. - if [ -n "$(command -v tmux 2>/dev/null)" ]; then + if [ "$(command -v tmux 2>/dev/null)" ]; then # Added for users compiling tmux from source to bypass check. tmuxcheck=1 else diff --git a/lgsm/functions/command_dev_detect_deps.sh b/lgsm/functions/command_dev_detect_deps.sh index 252b37022b..50b9078c8d 100644 --- a/lgsm/functions/command_dev_detect_deps.sh +++ b/lgsm/functions/command_dev_detect_deps.sh @@ -13,9 +13,9 @@ echo -e "Dependencies Checker" echo -e "=================================" echo -e "Checking directory: " echo -e "${serverfiles}" -if [ -n "$(command -v eu-readelf 2>/dev/null)" ]; then +if [ "$(command -v eu-readelf 2>/dev/null)" ]; then readelf=eu-readelf -elif [ -n "$(command -v readelf 2>/dev/null)" ]; then +elif [ "$(command -v readelf 2>/dev/null)" ]; then readelf=readelf else echo -e "readelf/eu-readelf not installed" diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh index e86fb05db0..c5c624ed23 100644 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/functions/command_dev_detect_glibc.sh @@ -13,7 +13,7 @@ echo -e "=================================" echo -e "glibc Requirements Checker" echo -e "=================================" -if [ -z "$(command -v objdump)" ]; then +if [ ! "$(command -v objdump)" ]; then fn_print_failure_nl "objdump is missing" fn_script_log_fatal "objdump is missing" core_exit.sh diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index d862c7ed85..de74f62f84 100644 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -23,7 +23,7 @@ luafastdlfile="lgsm_cl_force_fastdl.lua" luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" # Check if bzip2 is installed. -if [ -z "$(command -v bzip2 2>/dev/null)" ]; then +if [ ! "$(command -v bzip2 2>/dev/null)" ]; then fn_print_fail "bzip2 is not installed" fn_script_log_fatal "bzip2 is not installed" core_exit.sh diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index 363189098f..0dada94640 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -211,7 +211,7 @@ fn_monitor_loop(){ do # Will check if gamedig is installed and bypass if not. if [ "${querymethod}" == "gamedig" ]; then - if [ -n "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then + if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then if [ -z "${monitorpass}" ]; then fn_monitor_query fi diff --git a/lgsm/functions/command_stop.sh b/lgsm/functions/command_stop.sh index f166fa552a..03a3bff183 100644 --- a/lgsm/functions/command_stop.sh +++ b/lgsm/functions/command_stop.sh @@ -126,7 +126,7 @@ fn_stop_graceful_sdtd(){ fn_script_log_info "Graceful: telnet" if [ "${telnetenabled}" == "false" ]; then fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}" - elif [ -n "$(command -v expect 2>/dev/null)" ]; then + elif [ "$(command -v expect 2>/dev/null)" ]; then # Tries to shutdown with both localhost and server IP. for telnetip in 127.0.0.1 ${ip}; do fn_print_dots "Graceful: telnet: ${telnetip}:${telnetport}" diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 83d9f119bc..8ce12b2067 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -18,7 +18,7 @@ fn_validation(){ cd "${steamcmddir}" || exit # Detects if unbuffer command is available for 32 bit distributions only. info_distro.sh - if [ -n "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then + if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then unbuffer="stdbuf -i0 -o0 -e0" fi diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index 24cff68bf7..e4114209f9 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -256,7 +256,7 @@ fn_update_function(){ } # Check that curl is installed -if [ -z "$(command -v curl 2>/dev/null)" ]; then +if [ ! "$(command -v curl 2>/dev/null)" ]; then echo -e "[ FAIL ] Curl is not installed" exit 1 fi diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index 38305c6e38..9abb31b974 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -32,7 +32,7 @@ do distroversion=$(grep VERSION_ID /etc/os-release | sed 's/VERSION_ID=//g' | sed 's/\"//g') distroid=$(grep ID /etc/os-release | grep -v _ID | grep -v ID_ | sed 's/ID=//g' | sed 's/\"//g') distrocodename=$(grep VERSION_CODENAME /etc/os-release | sed 's/VERSION_CODENAME=//g' | sed 's/\"//g') - elif [ -n "$(command -v lsb_release 2>/dev/null)" ]&&[ "${distro_info}" == "lsb_release" ]; then + elif [ "$(command -v lsb_release 2>/dev/null)" ]&&[ "${distro_info}" == "lsb_release" ]; then if [ -z "${distroname}" ];then distroname=$(lsb_release -sd) elif [ -z "${distroversion}" ];then @@ -42,7 +42,7 @@ do elif [ -z "${distrocodename}" ];then distrocodename=$(lsb_release -sc) fi - elif [ -n "$(command -v hostnamectl 2>/dev/null)" ]&&[ "${distro_info}" == "hostnamectl" ]; then + elif [ "$(command -v hostnamectl 2>/dev/null)" ]&&[ "${distro_info}" == "hostnamectl" ]; then if [ -z "${distroname}" ];then distroname=$(hostnamectl | grep "Operating System" | sed 's/Operating System: //g') fi @@ -71,7 +71,7 @@ glibcversion=$(ldd --version | sed -n '1s/.* //p') ## tmux version # e.g: tmux 1.6 -if [ -z "$(command -V tmux 2>/dev/null)" ]; then +if [ ! "$(command -V tmux 2>/dev/null)" ]; then tmuxv="${red}NOT INSTALLED!${default}" else if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then @@ -107,7 +107,7 @@ fi # Available RAM and swap. # Newer distros can use numfmt to give more accurate results. -if [ -n "$(command -v numfmt 2>/dev/null)" ]; then +if [ "$(command -v numfmt 2>/dev/null)" ]; then # Issue #2005 - Kernel 3.14+ contains MemAvailable which should be used. All others will be calculated. # get the raw KB values of these fields. @@ -252,7 +252,7 @@ else fi # Steam Master Server - checks if detected by master server. -if [ -n "$(command -v jq 2>/dev/null)" ]; then +if [ "$(command -v jq 2>/dev/null)" ]; then if [ "${ip}" ]&&[ "${port}" ]; then if [ "${steammaster}" == "true" ]; then masterserver=$(curl -m 3 -s 'https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr='${ip}':'${port}'&format=json' | jq '.response.servers[]|.addr' | wc -l) diff --git a/lgsm/functions/info_stats.sh b/lgsm/functions/info_stats.sh index f31db13d7d..ef0788fad8 100644 --- a/lgsm/functions/info_stats.sh +++ b/lgsm/functions/info_stats.sh @@ -10,7 +10,7 @@ info_distro.sh if [ ! -f "${datadir}/uuid.txt" ];then mkdir -p "${datadir}" touch "${datadir}/uuid.txt" - if [ -n "$(command -v uuidgen 2>/dev/null)" ]; then + if [ "$(command -v uuidgen 2>/dev/null)" ]; then uuidgen > "${datadir}/uuid.txt" else cat /proc/sys/kernel/random/uuid > "${datadir}/uuid.txt" diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index b2158b3e78..bb49d09003 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -98,7 +98,7 @@ fn_install_server_files_steamcmd(){ # Detects if unbuffer command is available for 32 bit distributions only. info_distro.sh - if [ -n "$(command -v stdbuf 2>/dev/null)" ]&&[ "${arch}" != "x86_64" ]; then + if [ "$(command -v stdbuf 2>/dev/null)" ]&&[ "${arch}" != "x86_64" ]; then unbuffer="stdbuf -i0 -o0 -e0" fi diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh index 88e01af5f8..4f1bc56383 100644 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -6,7 +6,7 @@ # https://github.com/sonicsnes/node-gamedig # Check if gamedig and jq are installed. -if [ -n "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then +if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; then # will bypass query if server offline. check_status.sh diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 38b7445de5..07dbdf9e33 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -13,7 +13,7 @@ fn_update_steamcmd_dl(){ # Detects if unbuffer command is available for 32 bit distributions only. info_distro.sh - if [ -n "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then + if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then unbuffer="stdbuf -i0 -o0 -e0" fi diff --git a/linuxgsm.sh b/linuxgsm.sh index 1a000656c6..e7afc14b49 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -72,7 +72,7 @@ fn_bootstrap_fetch_file(){ fi # If curl exists download file. - if [ -n "$(command -v curl 2>/dev/null)" ]; then + if [ "$(command -v curl 2>/dev/null)" ]; then # Trap to remove part downloaded files. echo -en " fetching ${local_filename}...\c" curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) @@ -192,7 +192,7 @@ fn_install_menu() { options=$4 # Get menu command. for menucmd in whiptail dialog bash; do - if [ -x "$(command -v "${menucmd}")" ]; then + if [ "$(command -v "${menucmd}")" ]; then menucmd=$(command -v "${menucmd}") break fi diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 97aea9caa0..6561c7ff43 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -81,7 +81,7 @@ fn_bootstrap_fetch_file(){ fi # If curl exists download file. - if [ -n "$(command -v curl 2>/dev/null)" ]; then + if [ "$(command -v curl 2>/dev/null)" ]; then # Trap to remove part downloaded files. echo -en " fetching ${local_filename}...\c" curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) @@ -201,7 +201,7 @@ fn_install_menu() { options=$4 # Get menu command. for menucmd in whiptail dialog bash; do - if [ -x "$(command -v "${menucmd}")" ]; then + if [ "$(command -v "${menucmd}")" ]; then menucmd=$(command -v "${menucmd}") break fi diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index b80af65542..9478fa6385 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -201,7 +201,7 @@ fn_install_menu() { options=$4 # Get menu command. for menucmd in whiptail dialog bash; do - if [ -x "$(command -v "${menucmd}")" ]; then + if [ "$(command -v "${menucmd}")" ]; then menucmd=$(command -v "${menucmd}") break fi diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 304e125eba..8224c5e8c7 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -81,7 +81,7 @@ fn_bootstrap_fetch_file(){ fi # If curl exists download file. - if [ -n "$(command -v curl 2>/dev/null)" ]; then + if [ "$(command -v curl 2>/dev/null)" ]; then # Trap to remove part downloaded files. echo -en " fetching ${local_filename}...\c" curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) @@ -201,7 +201,7 @@ fn_install_menu() { options=$4 # Get menu command. for menucmd in whiptail dialog bash; do - if [ -x "$(command -v "${menucmd}")" ]; then + if [ "$(command -v "${menucmd}")" ]; then menucmd=$(command -v "${menucmd}") break fi diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index f1544c4726..831b1f207b 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -81,7 +81,7 @@ fn_bootstrap_fetch_file(){ fi # If curl exists download file. - if [ -n "$(command -v curl 2>/dev/null)" ]; then + if [ "$(command -v curl 2>/dev/null)" ]; then # Trap to remove part downloaded files. echo -en " fetching ${local_filename}...\c" curlcmd=$(curl -s --fail -L -o "${local_filedir}/${local_filename}" "${remote_fileurl}" 2>&1) @@ -201,7 +201,7 @@ fn_install_menu() { options=$4 # Get menu command. for menucmd in whiptail dialog bash; do - if [ -x "$(command -v "${menucmd}")" ]; then + if [ "$(command -v "${menucmd}")" ]; then menucmd=$(command -v "${menucmd}") break fi From ef7cdb0d9efe3f692666252524dda041e6092b50 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 16 Feb 2020 23:21:19 +0000 Subject: [PATCH 2/8] feat: debian based distros will now use the steamcmd package --- lgsm/functions/check_deps.sh | 2 +- lgsm/functions/check_steamcmd.sh | 37 ++++++++++++++++++-------- lgsm/functions/command_validate.sh | 8 +++--- lgsm/functions/install_server_files.sh | 14 +++++----- lgsm/functions/update_steamcmd.sh | 15 ++++++----- 5 files changed, 49 insertions(+), 27 deletions(-) diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index c88f2870ca..d4ddc8eed2 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -335,7 +335,7 @@ fn_deps_build_debian(){ array_deps_missing=() # LinuxGSM requirements. - array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python3 tar bzip2 gzip unzip binutils bc jq ) + array_deps_required=( curl wget ca-certificates file bsdmainutils util-linux python3 tar bzip2 gzip unzip binutils bc jq steamcmd ) if [ "$(command -v tmux 2>/dev/null)" ]; then tmuxcheck=1 # Added for users compiling tmux from source to bypass check. diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 3f6cd90de8..69760f62f7 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -7,12 +7,13 @@ local commandname="CHECK" fn_install_steamcmd(){ - if [ ! -d "${steamcmddir}" ]; then - mkdir -pv "${steamcmddir}" + if [ ! -d "${steamcmddir}" ]; then + mkdir -pv "${steamcmddir}" + fi + fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz" + fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" + chmod +x "${steamcmddir}/steamcmd.sh" fi - fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz" - fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" - chmod +x "${steamcmddir}/steamcmd.sh" } fn_check_steamcmd_user(){ @@ -46,13 +47,19 @@ fn_check_steamcmd_user(){ fn_check_steamcmd_sh(){ # Checks if SteamCMD exists when starting or updating a server. # Installs if missing. - if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then - if [ "${function_selfname}" == "command_install.sh" ]; then - fn_install_steamcmd + if [ ! -f "${steamcmddir}/steamcmd.sh" ]||[ ! "$(command -v steamcmd 2>/dev/null)" ]; then + # Debian and Ubuntu uses steamcmd package + if [ -f "/etc/debian_version" ]&&[ ! "$(command -v steamcmd 2>/dev/null)" ]; then + # Install steamcmd with apt + : else - fn_print_error_nl "SteamCMD is missing" - fn_script_log_error "SteamCMD is missing" - fn_install_steamcmd + if [ "${function_selfname}" == "command_install.sh" ]; then + fn_install_steamcmd + else + fn_print_error_nl "SteamCMD is missing" + fn_script_log_error "SteamCMD is missing" + fn_install_steamcmd + fi fi elif [ "${function_selfname}" == "command_install.sh" ]; then fn_print_information "SteamCMD is already installed..." @@ -60,5 +67,13 @@ fn_check_steamcmd_sh(){ fi } +fn_check_steamcmd_check(){ + if [ "$(command -v steamcmd 2>/dev/null)" ]; then + steamcmdcommand="steamcmd" + else + steamcmdcommand="${steamcmdcommand}" +} + fn_check_steamcmd_user fn_check_steamcmd_sh +fn_check_steamcmd_check diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 8ce12b2067..93688892ed 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -15,7 +15,9 @@ fn_validation(){ echo -e "* https://docs.linuxgsm.com/commands/validate" fn_script_log_info "Validating files: SteamCMD" sleep 3 - cd "${steamcmddir}" || exit + if [ "${steamcmddir}" ]; then + cd "${steamcmddir}" || exit + fi # Detects if unbuffer command is available for 32 bit distributions only. info_distro.sh if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then @@ -23,9 +25,9 @@ fn_validation(){ fi if [ "${appid}" == "90" ]; then - ${unbuffer} ./steamcmd.sh +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}" + ${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} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit | tee -a "${lgsmlog}" fi if [ $? != 0 ]; then fn_print_fail_nl "Validating files: SteamCMD" diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index bb49d09003..5534679613 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -74,7 +74,9 @@ fn_install_server_files_steamcmd(){ counter="0" while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do counter=$((counter+1)) - cd "${steamcmddir}" || exit + if [ "${steamcmddir}" ]; then + cd "${steamcmddir}" || exit + fi if [ "${counter}" -le "10" ]; then # Attempt 1-4: Standard attempt. # Attempt 5-6: Validate attempt. @@ -104,18 +106,18 @@ fn_install_server_files_steamcmd(){ if [ "${counter}" -le "4" ]; then if [ "${appid}" == "90" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit local exitcode=$? else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit local exitcode=$? fi elif [ "${counter}" -ge "5" ]; then if [ "${engine}" == "goldsource" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" validate +quit local exitcode=$? else - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" validate +quit local exitcode=$? fi fi @@ -133,7 +135,7 @@ fn_install_server_files_steamcmd(){ counter="0" while [ "${counter}" -le "4" ]; do counter=$((counter+1)) - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" "${branch}" validate +quit local exitcode=$? done fi diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 07dbdf9e33..4b6b60bc3d 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -16,12 +16,13 @@ fn_update_steamcmd_dl(){ if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then unbuffer="stdbuf -i0 -o0 -e0" fi - - cd "${steamcmddir}" || exit + if [ "${steamcmddir}" ]; then + cd "${steamcmddir}" || exit + fi if [ "${appid}" == "90" ]; then - ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_set_config 90 mod "${appidmod}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + ${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} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" + ${unbuffer} ${steamcmdcommand} +login "${steamuser}" "${steampass}" +force_install_dir "${serverfiles}" +app_update "${appid}" -beta "${branch}" +quit | tee -a "${lgsmlog}" fi fix.sh } @@ -50,8 +51,10 @@ fn_update_steamcmd_localbuild(){ fn_update_steamcmd_remotebuild(){ # Gets remote build info. - cd "${steamcmddir}" || exit - remotebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed '1,/branches/d' | sed "1,/${branchname}/d" | grep -m 1 buildid | tr -cd '[:digit:]') + if [ "${steamcmddir}" ]; then + cd "${steamcmddir}" || exit + fi + remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed '1,/branches/d' | sed "1,/${branchname}/d" | grep -m 1 buildid | tr -cd '[:digit:]') if [ "${installer}" != "1" ]; then fn_print_dots "Checking for update: ${remotelocation}: checking remote build" # Checks if remotebuild variable has been set. From 83e2cbf9be17a5ca01420ed91f1554a42a2d7e18 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 16 Feb 2020 23:48:12 +0000 Subject: [PATCH 3/8] bugs --- lgsm/functions/check_steamcmd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 69760f62f7..3c71775193 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -13,7 +13,6 @@ fn_install_steamcmd(){ fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz" fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" chmod +x "${steamcmddir}/steamcmd.sh" - fi } fn_check_steamcmd_user(){ @@ -71,7 +70,8 @@ fn_check_steamcmd_check(){ if [ "$(command -v steamcmd 2>/dev/null)" ]; then steamcmdcommand="steamcmd" else - steamcmdcommand="${steamcmdcommand}" + steamcmdcommand="./steamcmd.sh" + fi } fn_check_steamcmd_user From 3d43e187420ba4ab23aba19730ed440687b7b3bf Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 17 Feb 2020 00:15:45 +0000 Subject: [PATCH 4/8] code --- lgsm/functions/check_steamcmd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 3c71775193..800d737ae6 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -48,7 +48,7 @@ fn_check_steamcmd_sh(){ # Installs if missing. if [ ! -f "${steamcmddir}/steamcmd.sh" ]||[ ! "$(command -v steamcmd 2>/dev/null)" ]; then # Debian and Ubuntu uses steamcmd package - if [ -f "/etc/debian_version" ]&&[ ! "$(command -v steamcmd 2>/dev/null)" ]; then + if [ -f "/etc/debian_version" ]&&[ "$(command -v steamcmd 2>/dev/null)" ]; then # Install steamcmd with apt : else From 9e811a7ba0ea9cf80d7cda17bf01cd6b02b45b33 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 17 Feb 2020 00:18:04 +0000 Subject: [PATCH 5/8] code --- lgsm/functions/command_validate.sh | 2 +- lgsm/functions/install_server_files.sh | 2 +- lgsm/functions/update_steamcmd.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 93688892ed..55a58d2669 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -15,7 +15,7 @@ fn_validation(){ echo -e "* https://docs.linuxgsm.com/commands/validate" fn_script_log_info "Validating files: SteamCMD" sleep 3 - if [ "${steamcmddir}" ]; then + if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi # Detects if unbuffer command is available for 32 bit distributions only. diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index 5534679613..2dc224831d 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -74,7 +74,7 @@ fn_install_server_files_steamcmd(){ counter="0" while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do counter=$((counter+1)) - if [ "${steamcmddir}" ]; then + if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi if [ "${counter}" -le "10" ]; then diff --git a/lgsm/functions/update_steamcmd.sh b/lgsm/functions/update_steamcmd.sh index 4b6b60bc3d..fcb2894850 100644 --- a/lgsm/functions/update_steamcmd.sh +++ b/lgsm/functions/update_steamcmd.sh @@ -16,7 +16,7 @@ fn_update_steamcmd_dl(){ if [ "$(command -v stdbuf)" ]&&[ "${arch}" != "x86_64" ]; then unbuffer="stdbuf -i0 -o0 -e0" fi - if [ "${steamcmddir}" ]; then + if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi if [ "${appid}" == "90" ]; then @@ -51,7 +51,7 @@ fn_update_steamcmd_localbuild(){ fn_update_steamcmd_remotebuild(){ # Gets remote build info. - if [ "${steamcmddir}" ]; then + if [ -d "${steamcmddir}" ]; then cd "${steamcmddir}" || exit fi remotebuild=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed '1,/branches/d' | sed "1,/${branchname}/d" | grep -m 1 buildid | tr -cd '[:digit:]') From 6a594b4cf8ab2e8c563a344ad72ff893961e6520 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 19 Feb 2020 22:08:43 +0000 Subject: [PATCH 6/8] code --- lgsm/functions/check_steamcmd.sh | 56 ++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 800d737ae6..67fe77642b 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -7,12 +7,12 @@ local commandname="CHECK" fn_install_steamcmd(){ - if [ ! -d "${steamcmddir}" ]; then - mkdir -pv "${steamcmddir}" - fi - fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz" - fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" - chmod +x "${steamcmddir}/steamcmd.sh" + if [ ! -d "${steamcmddir}" ]; then + mkdir -pv "${steamcmddir}" + fi + fn_fetch_file "http://media.steampowered.com/client/steamcmd_linux.tar.gz" "${tmpdir}" "steamcmd_linux.tar.gz" + fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" + chmod +x "${steamcmddir}/steamcmd.sh" } fn_check_steamcmd_user(){ @@ -43,30 +43,37 @@ fn_check_steamcmd_user(){ fi } -fn_check_steamcmd_sh(){ +fn_check_steamcmd(){ # Checks if SteamCMD exists when starting or updating a server. - # Installs if missing. - if [ ! -f "${steamcmddir}/steamcmd.sh" ]||[ ! "$(command -v steamcmd 2>/dev/null)" ]; then - # Debian and Ubuntu uses steamcmd package - if [ -f "/etc/debian_version" ]&&[ "$(command -v steamcmd 2>/dev/null)" ]; then - # Install steamcmd with apt - : + # Only install if steamcmd package is missing or steamcmd dir is missing. + if [ ! -f "${steamcmddir}/steamcmd.sh" ]&&[ ! "$(command -v steamcmd 2>/dev/null)" ]; then + if [ "${function_selfname}" == "command_install.sh" ]; then + fn_install_steamcmd else - if [ "${function_selfname}" == "command_install.sh" ]; then - fn_install_steamcmd - else - fn_print_error_nl "SteamCMD is missing" - fn_script_log_error "SteamCMD is missing" - fn_install_steamcmd - fi + fn_print_error_nl "SteamCMD is missing" + fn_script_log_error "SteamCMD is missing" + fn_install_steamcmd fi elif [ "${function_selfname}" == "command_install.sh" ]; then - fn_print_information "SteamCMD is already installed..." + fn_print_information "SteamCMD is already installed" fn_print_ok_eol_nl fi } -fn_check_steamcmd_check(){ +fn_check_steamcmd_clear(){ +# Will remove steamcmd dir if steamcmd package is installed. +if [ "$(command -v steamcmd 2>/dev/null)" ]&&[ -d "${steamcmddir}" ]; then + rm -rf "${steamcmddir:?}" + exitcode=$? + if [ ${exitcode} -ne 0 ]; then + fn_script_log_fatal "Removing ${steamcmddir}" + else + fn_script_log_pass "Removing ${steamcmddir}" + fi +fi +} + +fn_check_steamcmd_exec(){ if [ "$(command -v steamcmd 2>/dev/null)" ]; then steamcmdcommand="steamcmd" else @@ -74,6 +81,7 @@ fn_check_steamcmd_check(){ fi } +fn_check_steamcmd +fn_check_steamcmd_clear fn_check_steamcmd_user -fn_check_steamcmd_sh -fn_check_steamcmd_check +fn_check_steamcmd_exec From df9218df9afe3c6a886526f53ef6322f6fb26e41 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 6 Mar 2020 22:12:56 +0000 Subject: [PATCH 7/8] changed some ! back to -z --- lgsm/functions/check_steamcmd.sh | 2 +- lgsm/functions/command_dev_detect_glibc.sh | 2 +- lgsm/functions/command_fastdl.sh | 2 +- lgsm/functions/core_dl.sh | 2 +- lgsm/functions/info_distro.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lgsm/functions/check_steamcmd.sh b/lgsm/functions/check_steamcmd.sh index 67fe77642b..77f46033d3 100644 --- a/lgsm/functions/check_steamcmd.sh +++ b/lgsm/functions/check_steamcmd.sh @@ -46,7 +46,7 @@ fn_check_steamcmd_user(){ fn_check_steamcmd(){ # Checks if SteamCMD exists when starting or updating a server. # Only install if steamcmd package is missing or steamcmd dir is missing. - if [ ! -f "${steamcmddir}/steamcmd.sh" ]&&[ ! "$(command -v steamcmd 2>/dev/null)" ]; then + if [ ! -f "${steamcmddir}/steamcmd.sh" ]&&[ -z "$(command -v steamcmd 2>/dev/null)" ]; then if [ "${function_selfname}" == "command_install.sh" ]; then fn_install_steamcmd else diff --git a/lgsm/functions/command_dev_detect_glibc.sh b/lgsm/functions/command_dev_detect_glibc.sh index c5c624ed23..e86fb05db0 100644 --- a/lgsm/functions/command_dev_detect_glibc.sh +++ b/lgsm/functions/command_dev_detect_glibc.sh @@ -13,7 +13,7 @@ echo -e "=================================" echo -e "glibc Requirements Checker" echo -e "=================================" -if [ ! "$(command -v objdump)" ]; then +if [ -z "$(command -v objdump)" ]; then fn_print_failure_nl "objdump is missing" fn_script_log_fatal "objdump is missing" core_exit.sh diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index de74f62f84..d862c7ed85 100644 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -23,7 +23,7 @@ luafastdlfile="lgsm_cl_force_fastdl.lua" luafastdlfullpath="${luasvautorundir}/${luafastdlfile}" # Check if bzip2 is installed. -if [ ! "$(command -v bzip2 2>/dev/null)" ]; then +if [ -z "$(command -v bzip2 2>/dev/null)" ]; then fn_print_fail "bzip2 is not installed" fn_script_log_fatal "bzip2 is not installed" core_exit.sh diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index e4114209f9..24cff68bf7 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -256,7 +256,7 @@ fn_update_function(){ } # Check that curl is installed -if [ ! "$(command -v curl 2>/dev/null)" ]; then +if [ -z "$(command -v curl 2>/dev/null)" ]; then echo -e "[ FAIL ] Curl is not installed" exit 1 fi diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index 9abb31b974..f40d5b0484 100644 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -71,7 +71,7 @@ glibcversion=$(ldd --version | sed -n '1s/.* //p') ## tmux version # e.g: tmux 1.6 -if [ ! "$(command -V tmux 2>/dev/null)" ]; then +if [ -z "$(command -V tmux 2>/dev/null)" ]; then tmuxv="${red}NOT INSTALLED!${default}" else if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then From e13990694da24ac0c2f773314976383f7e37af87 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 6 Mar 2020 22:18:13 +0000 Subject: [PATCH 8/8] tabs --- lgsm/functions/install_server_files.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index 2dc224831d..5c1cfd7fb5 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -9,7 +9,7 @@ local commandaction="Install" local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")") fn_install_server_files(){ - if [ "${shortname}" == "ahl" ]; then + if [ "${shortname}" == "ahl" ]; then remote_fileurl="http://files.linuxgsm.com/ActionHalfLife/action_halflife-1.0.tar.bz2"; local_filedir="${tmpdir}"; local_filename="action_halflife-1.0.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="31430e670692b2eeaa0d1217db4dcb73" elif [ "${shortname}" == "bf1942" ]; then remote_fileurl="http://files.linuxgsm.com/BattleField1942/bf1942_lnxded-1.61-hacked-to-1.612.full.tar.bz2"; local_filedir="${tmpdir}"; local_filename="bf1942_lnxded-1.61-hacked-to-1.612.full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="a86a5d3cd64ca59abcc9bb9f777c2e5d" @@ -74,9 +74,9 @@ fn_install_server_files_steamcmd(){ counter="0" while [ "${counter}" == "0" ]||[ "${exitcode}" != "0" ]; do counter=$((counter+1)) - if [ -d "${steamcmddir}" ]; then - cd "${steamcmddir}" || exit - fi + if [ -d "${steamcmddir}" ]; then + cd "${steamcmddir}" || exit + fi if [ "${counter}" -le "10" ]; then # Attempt 1-4: Standard attempt. # Attempt 5-6: Validate attempt.