Browse Source

feat: debian based distros will now use the steamcmd package

pull/2697/head
Daniel Gibbs 5 years ago
parent
commit
ef7cdb0d9e
  1. 2
      lgsm/functions/check_deps.sh
  2. 37
      lgsm/functions/check_steamcmd.sh
  3. 8
      lgsm/functions/command_validate.sh
  4. 14
      lgsm/functions/install_server_files.sh
  5. 15
      lgsm/functions/update_steamcmd.sh

2
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.

37
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

8
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"

14
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

15
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.

Loading…
Cancel
Save