|
@@ -2,54 +2,77 @@
|
|
|
# LGSM check_deps.sh function
|
|
# LGSM check_deps.sh function
|
|
|
# Author: Daniel Gibbs
|
|
# Author: Daniel Gibbs
|
|
|
# Website: http://gameservermanagers.com
|
|
# Website: http://gameservermanagers.com
|
|
|
|
|
+lgsm_version="170116"
|
|
|
|
|
|
|
|
# Description: Checks that the require dependencies are installed for LGSM
|
|
# Description: Checks that the require dependencies are installed for LGSM
|
|
|
|
|
|
|
|
|
|
|
|
|
fn_deps_detector(){
|
|
fn_deps_detector(){
|
|
|
|
|
+# Checks is dependency is missing
|
|
|
if [ -n "$(command -v dpkg-query)" ]; then
|
|
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} | grep -q -P '^install ok installed$'
|
|
|
depstatus=$?
|
|
depstatus=$?
|
|
|
-elif [ -n "$(command -v rpm)" ]; then
|
|
|
|
|
- rpm -qa ${deptocheck} |grep -q -P ${deptocheck}
|
|
|
|
|
- depstatus=$?
|
|
|
|
|
-else
|
|
|
|
|
- echo "Unknown OS"
|
|
|
|
|
|
|
+ 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
|
|
|
|
|
+if [ "${missingdep}" == "1" ]; then
|
|
|
|
|
+ array_deps_missing+=("${deptocheck}")
|
|
|
fi
|
|
fi
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+fn_deps_email(){
|
|
|
|
|
+# Adds postfix to required dependencies if email notification is enabled
|
|
|
|
|
+if [ "${emailnotification}" == "on" ]; then
|
|
|
|
|
+ array_deps_required+=("mailutils postfix")
|
|
|
|
|
+fi
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
cd "${executabledir}"
|
|
cd "${executabledir}"
|
|
|
-if [ "${executable}" == "./hlds_run" ]; then
|
|
|
|
|
- local depslist=( lib32gcc1 libstdc++6 libstdc++6:i386 )
|
|
|
|
|
- for deptocheck in "${depstocheck[@]}"
|
|
|
|
|
- do
|
|
|
|
|
- fn_deps_detector
|
|
|
|
|
- done
|
|
|
|
|
- # gold source lib32gcc1 libstdc++6 libstdc++6:i386
|
|
|
|
|
-elif [ "${executable}" == "./srcds_run" ]||[ "${executable}" == "./dabds.sh" ]||[ "${executable}" == "./srcds_run.sh" ]; then
|
|
|
|
|
- local depslist=( lib32gcc1 libstdc++6 libstdc++6:i386 )
|
|
|
|
|
- for deptocheck in "${depstocheck[@]}"
|
|
|
|
|
- do
|
|
|
|
|
- fn_deps_detector
|
|
|
|
|
- done
|
|
|
|
|
- # source lib32gcc1 libstdc++6 libstdc++6:i386
|
|
|
|
|
-elif [ "${executable}" == "./server_linux32" ]; then
|
|
|
|
|
- # lib32gcc1 libstdc++6 libstdc++6:i386 speex:i386 libtbb2
|
|
|
|
|
-elif [ "${executable}" == "./runSam3_DedicatedServer.sh" ]; then
|
|
|
|
|
- # spark lib32gcc1 libstdc++6 libstdc++6:i386
|
|
|
|
|
-elif [ "${executable}" == "./7DaysToDie.sh" ]; then
|
|
|
|
|
- # lib32gcc1 libstdc++6 libstdc++6:i386 telnet expect
|
|
|
|
|
-elif [ "${executable}" == "./ucc-bin" ]; then
|
|
|
|
|
-
|
|
|
|
|
- if [ -f "${executabledir}/ucc-bin-real" ]; then
|
|
|
|
|
- executable=ucc-bin-real
|
|
|
|
|
- elif [ -f "${executabledir}/ut2004-bin" ]; then
|
|
|
|
|
- executable=ut2004-bin
|
|
|
|
|
- else
|
|
|
|
|
- executable=ut-bin
|
|
|
|
|
- fi
|
|
|
|
|
|
|
+# 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
|
|
|
|
|
+elif
|
|
|
|
|
+else
|
|
|
|
|
+ fn_printfail "Unknown executable"
|
|
|
|
|
+ exit
|
|
|
|
|
+fi
|
|
|
|
|
|
|
|
-elif [ "${executable}" == "./ts3server_startscript.sh" ]; then
|
|
|
|
|
- executable=ts3server_linux_amd64
|
|
|
|
|
|
|
+# Loop though required depenencies
|
|
|
|
|
+for deptocheck in "${array_deps_required[@]}"
|
|
|
|
|
+do
|
|
|
|
|
+ fn_deps_detector
|
|
|
|
|
+done
|
|
|
|
|
+
|
|
|
|
|
+if [ "${#array_deps_missing[@]}" != "0" ]; then
|
|
|
|
|
+ fn_printwarnnl "Dependency Missing: \e[0;31m${array_deps_missing[@]}\e[0m"
|
|
|
|
|
+ sleep 2
|
|
|
|
|
+ sudo -n true
|
|
|
|
|
+ if [ $? -eq 0 ]; then
|
|
|
|
|
+ fn_printinfonl "Attempting to install missing dependencies automatically"
|
|
|
|
|
+ echo -en ".\r"
|
|
|
|
|
+ sleep 1
|
|
|
|
|
+ echo -en "..\r"
|
|
|
|
|
+ sleep 1
|
|
|
|
|
+ echo -en "...\r"
|
|
|
|
|
+ sleep 1
|
|
|
|
|
+ echo -en " \r"
|
|
|
|
|
+ sudo apt-get install ${array_deps_missing[@]}
|
|
|
|
|
+ else
|
|
|
|
|
+ echo "sudo apt-get install ${array_deps_missing[@]}"
|
|
|
|
|
+ fi
|
|
|
|
|
+else
|
|
|
|
|
+ fn_printoknl "Checking for missing dependencies"
|
|
|
fi
|
|
fi
|