Browse Source

code

pull/2697/head
Daniel Gibbs 5 years ago
parent
commit
6a594b4cf8
  1. 34
      lgsm/functions/check_steamcmd.sh

34
lgsm/functions/check_steamcmd.sh

@ -43,15 +43,10 @@ fn_check_steamcmd_user(){
fi fi
} }
fn_check_steamcmd_sh(){ fn_check_steamcmd(){
# Checks if SteamCMD exists when starting or updating a server. # Checks if SteamCMD exists when starting or updating a server.
# Installs if missing. # 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" ]&&[ ! "$(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
if [ "${function_selfname}" == "command_install.sh" ]; then if [ "${function_selfname}" == "command_install.sh" ]; then
fn_install_steamcmd fn_install_steamcmd
else else
@ -59,14 +54,26 @@ fn_check_steamcmd_sh(){
fn_script_log_error "SteamCMD is missing" fn_script_log_error "SteamCMD is missing"
fn_install_steamcmd fn_install_steamcmd
fi fi
fi
elif [ "${function_selfname}" == "command_install.sh" ]; then 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 fn_print_ok_eol_nl
fi 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 if [ "$(command -v steamcmd 2>/dev/null)" ]; then
steamcmdcommand="steamcmd" steamcmdcommand="steamcmd"
else else
@ -74,6 +81,7 @@ fn_check_steamcmd_check(){
fi fi
} }
fn_check_steamcmd
fn_check_steamcmd_clear
fn_check_steamcmd_user fn_check_steamcmd_user
fn_check_steamcmd_sh fn_check_steamcmd_exec
fn_check_steamcmd_check

Loading…
Cancel
Save