diff --git a/functions/fn_check_steamcmd b/functions/fn_check_steamcmd index 4ec0bb948..134ecccdc 100644 --- a/functions/fn_check_steamcmd +++ b/functions/fn_check_steamcmd @@ -12,22 +12,27 @@ if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tourn elif [ "${modulename}" == "Starting" ]||[ "${modulename}" == "Update" ]; then # Checks if SteamCMD exists when starting or updating a server. # Re-installs if missing. - if [ ! -f ${rootdir}/steamcmd/steamcmd.sh ]; then - fn_details_config - fn_printwarn "SteamCMD is missing" + steamcmddir="${rootdir}/steamcmd" + if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then + fn_printwarnnl "SteamCMD is missing" fn_scriptlog "SteamCMD is missing" sleep 1 - echo -en "\n" - mkdir -pv "${rootdir}/steamcmd" - cd "${rootdir}/steamcmd" + if [ ! -d "${steamcmddir}" ]; then + mkdir -v "${steamcmddir}" + fi + curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1) + exitcode=$? echo -e "downloading steamcmd_linux.tar.gz...\c" - wget -N /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq - tar --verbose -zxf steamcmd_linux.tar.gz - rm -v steamcmd_linux.tar.gz - chmod +x steamcmd.sh - fn_scriptlog "Re-installed SteamCMD" - fn_printdots "${servername}" - sleep 1 + if [ $exitcode -eq 0 ]; then + fn_printokeol + else + fn_printfaileol + echo "${curl}" + echo -e "${githuburl}\n" + exit $exitcode + fi + tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}" + rm -v "${steamcmddir}/steamcmd_linux.tar.gz" + chmod +x "${steamcmddir}/steamcmd.sh" fi - cd "${rootdir}" fi diff --git a/functions/fn_install_steamcmd b/functions/fn_install_steamcmd index d7921f457..d62405545 100644 --- a/functions/fn_install_steamcmd +++ b/functions/fn_install_steamcmd @@ -10,13 +10,11 @@ echo "" echo "Installing SteamCMD" echo "=================================" steamcmddir="${rootdir}/steamcmd" -if [ ! -d "${steamcmddir}" ]; then - mkdir -v "${steamcmddir}" -fi -sleep 1 -cd "${steamcmddir}" -if [ ! -f steamcmd.sh ]; then - curl=$(curl --fail -o "${rootdir}/steamcmd/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1) +if [ ! -f "${steamcmddir}/steamcmd.sh" ]; then + if [ ! -d "${steamcmddir}" ]; then + mkdir -v "${steamcmddir}" + fi + curl=$(curl --fail -o "${steamcmddir}/steamcmd_linux.tar.gz" "http://media.steampowered.com/client/steamcmd_linux.tar.gz" 2>&1) exitcode=$? echo -e "downloading steamcmd_linux.tar.gz...\c" if [ $exitcode -eq 0 ]; then @@ -27,10 +25,9 @@ if [ ! -f steamcmd.sh ]; then echo -e "${githuburl}\n" exit $exitcode fi - tar --verbose -zxf steamcmd_linux.tar.gz - rm -v steamcmd_linux.tar.gz - chmod +x steamcmd.sh - sleep 1 + tar --verbose -zxf "${steamcmddir}/steamcmd_linux.tar.gz" -C "${steamcmddir}" + rm -v "${steamcmddir}/steamcmd_linux.tar.gz" + chmod +x "${steamcmddir}/steamcmd.sh" else echo "SteamCMD already installed!" fi