diff --git a/functions/check_deps.sh b/functions/check_deps.sh index da297dc26..b279dc026 100644 --- a/functions/check_deps.sh +++ b/functions/check_deps.sh @@ -2,7 +2,7 @@ # LGSM check_deps.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="170116" +lgsm_version="310116" # Description: Checks that the require dependencies are installed for LGSM @@ -10,17 +10,14 @@ lgsm_version="170116" fn_deps_detector(){ # Checks is dependency is missing if [ -n "$(command -v dpkg-query)" ]; then - dpkg-query -W -f='${Status}' ${deptocheck} | grep -q -P '^install ok installed$' + dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null| grep -q -P '^install ok installed$' depstatus=$? if [ "${depstatus}" == "0" ]; then missingdep=0 - echo -en " \e[0;32m${deptocheck}\e[0m" else # if missing dependency is flagged missingdep=1 - echo -en " \e[0;31m${deptocheck}\e[0m" fi - sleep 0.5 fi # Add missing dependencies are added to array_deps_missing array @@ -32,33 +29,18 @@ fi fn_deps_email(){ # Adds postfix to required dependencies if email notification is enabled if [ "${emailnotification}" == "on" ]; then - array_deps_required+=("mailutils postfix") + array_deps_required+=( mailutils postfix ) fi } - -cd "${executabledir}" -# Generate array of missing deps -array_deps_missing=() -fn_printdots "Checking for missing dependencies:" -if [ "${executable}" == "./srcds_run" ]||[ "${executable}" == "./dabds.sh" ]||[ "${executable}" == "./srcds_run.sh" ]||[ "${executable}" == "./Jcmp-Server" ] ; then - local array_deps_required=( tmux curl lib32gcc1 libstdc++6:i386 ) - fn_deps_email -else - fn_printfail "Unknown executable" - exit -fi - -# Loop though required depenencies -for deptocheck in "${array_deps_required[@]}" -do - fn_deps_detector -done - +fn_found_missing_deps(){ if [ "${#array_deps_missing[@]}" != "0" ]; then - fn_printwarnnl "Dependency Missing: \e[0;31m${array_deps_missing[@]}\e[0m" + fn_printdots "Checking dependencies" sleep 2 - sudo -n true + fn_printwarn "Checking dependencies: Dependency missing: \e[0;31m${array_deps_missing[@]}\e[0m" + sleep 1 + echo -e "" + sudo -n true > /dev/null 2>&1 if [ $? -eq 0 ]; then fn_printinfonl "Attempting to install missing dependencies automatically" echo -en ".\r" @@ -69,9 +51,73 @@ if [ "${#array_deps_missing[@]}" != "0" ]; then sleep 1 echo -en " \r" sudo apt-get install ${array_deps_missing[@]} + exit 1 else + echo "" + fn_printinfomationnl "$(whoami) does not have sudo access. manually install dependencies" + echo "" echo "sudo apt-get install ${array_deps_missing[@]}" - fi -else - fn_printoknl "Checking for missing dependencies" + echo "" + exit 1 + fi +fi +} + + + +# Check will only run if using apt-get or yum +if [ -n "$(command -v dpkg-query)" ]; then + # Generate array of missing deps + array_deps_missing=() + fn_printdots "Checking dependencies" + + # LGSM requirement for curl + local array_deps_required=( curl ) + + # All servers except ts3 require tmux + if [ "${executable}" != "./ts3server_startscript.sh" ]; then + local array_deps_required+=( tmux ) + fi + + # All servers excelts ts3 & mumble require libstdc++6,lib32gcc1 + if [ "${executable}" != "./ts3server_startscript.sh" ]||[ "${executable}" != "./murmur.x86" ]; then + local array_deps_required+=( lib32gcc1 libstdc++6:i386 ) + fi + +# Game Specific requirements + + # Spark + if [ "${engine}" == "spark" ]; then + local array_deps_required+=( speex:i386 libtbb2 ) + # 7 Days to Die + elif [ "${executable}" == "./7DaysToDie.sh" ]; then + local array_deps_required+=( telnet expect ) + # Brainbread 2 and Don't Starve Together + elif [ "${gamename}" == "Brainbread 2" ]||[ "${gamename}" == "Don't Starve Together" ]; then + local array_deps_required+=( libcurl4-gnutls-dev:i386 ) + if [ "${engine}" == "projectzomboid" ]; then + local array_deps_required+=( openjdk-7-jre ) + # Unreal engine + elif [ "${executable}" == "./ucc-bin" ]; then + #UT2K4 + if [ -f "${executabledir}/ut2004-bin" ]; then + local array_deps_required+=( libsdl1.2debian libstdc++5:i386 bzip2 unzip ) + #UT99 + else + local array_deps_required+=( libsdl1.2debian bzip2 ) + fi + else + fn_printfail "Unknown executable" + exit + fi + fn_deps_email + + # Loop though required depenencies + for deptocheck in "${array_deps_required[@]}" + do + fn_deps_detector + done + + # user to be informaed of any missing dependecies + fn_found_missing_deps fi \ No newline at end of file diff --git a/functions/fn_update_functions b/functions/fn_update_functions index 185f44f5e..2de9afd6d 100644 --- a/functions/fn_update_functions +++ b/functions/fn_update_functions @@ -2,7 +2,7 @@ # LGSM update_functions.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="271215" +lgsm_version="230116" # Description: LEGACY FUNCTION Deletes the functions dir to allow re-downloading of functions from GitHub. @@ -14,9 +14,9 @@ rm -rfv "${rootdir}/functions/"* exitcode=$? if [ "${exitcode}" == "0" ]; then fn_printok "Updating functions" - fn_scriptlog "Successfull! Updating functions" + fn_scriptlog "Success! Updating functions" else - fn_printokfail "Updating functions" + fn_printfail "Updating functions" fn_scriptlog "Failure! Updating functions" fi echo -ne "\n" \ No newline at end of file diff --git a/functions/update_check.sh b/functions/update_check.sh index e0ba3ea96..38e786544 100644 --- a/functions/update_check.sh +++ b/functions/update_check.sh @@ -188,7 +188,6 @@ sleep 1 # Checks currentbuild info is available, if fails a server restart will be forced to generate logs if [ -z "$(find ./* -name 'ts3server*_0.log')" ]; then fn_printfail "Checking for update: teamspeak.com" - fn_scriptlog "Checking for update: teamspeak.com" sleep 1 fn_printfailnl "Checking for update: teamspeak.com: No logs with server version found" fn_scriptlog "Failure! Checking for update: teamspeak.com: No logs with server version found" diff --git a/functions/update_functions.sh b/functions/update_functions.sh index 350714ed0..196b90f75 100644 --- a/functions/update_functions.sh +++ b/functions/update_functions.sh @@ -2,7 +2,7 @@ # LGSM update_functions.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="271215" +lgsm_version="230116" # Description: Deletes the functions dir to allow re-downloading of functions from GitHub. @@ -16,9 +16,9 @@ rm -rfv "${rootdir}/functions/"* exitcode=$? if [ "${exitcode}" == "0" ]; then fn_printok "Updating functions" - fn_scriptlog "Successfull! Updating functions" + fn_scriptlog "Success! Updating functions" else - fn_printokfail "Updating functions" + fn_printfail "Updating functions" fn_scriptlog "Failure! Updating functions" fi echo -ne "\n" \ No newline at end of file