Browse Source

added jc2server

pull/667/head
Daniel Gibbs 9 years ago
parent
commit
708448b020
  1. 87
      functions/check_deps.sh

87
functions/check_deps.sh

@ -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=$?
elif [ -n "$(command -v rpm)" ]; then
rpm -qa ${deptocheck} |grep -q -P ${deptocheck}
depstatus=$? depstatus=$?
if [ "${depstatus}" == "0" ]; then
missingdep=0
echo -en " \e[0;32m${deptocheck}\e[0m"
else else
echo "Unknown OS" # 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 # Generate array of missing deps
local depslist=( lib32gcc1 libstdc++6 libstdc++6:i386 ) array_deps_missing=()
for deptocheck in "${depstocheck[@]}" fn_printdots "Checking for missing dependencies:"
do if [ "${executable}" == "./srcds_run" ]||[ "${executable}" == "./dabds.sh" ]||[ "${executable}" == "./srcds_run.sh" ]||[ "${executable}" == "./Jcmp-Server" ] ; then
fn_deps_detector local array_deps_required=( tmux curl lib32gcc1 libstdc++6:i386 )
done fn_deps_email
# gold source lib32gcc1 libstdc++6 libstdc++6:i386 elif
elif [ "${executable}" == "./srcds_run" ]||[ "${executable}" == "./dabds.sh" ]||[ "${executable}" == "./srcds_run.sh" ]; then else
local depslist=( lib32gcc1 libstdc++6 libstdc++6:i386 ) fn_printfail "Unknown executable"
for deptocheck in "${depstocheck[@]}" exit
fi
# Loop though required depenencies
for deptocheck in "${array_deps_required[@]}"
do do
fn_deps_detector fn_deps_detector
done done
# source lib32gcc1 libstdc++6 libstdc++6:i386
elif [ "${executable}" == "./server_linux32" ]; then if [ "${#array_deps_missing[@]}" != "0" ]; then
# lib32gcc1 libstdc++6 libstdc++6:i386 speex:i386 libtbb2 fn_printwarnnl "Dependency Missing: \e[0;31m${array_deps_missing[@]}\e[0m"
elif [ "${executable}" == "./runSam3_DedicatedServer.sh" ]; then sleep 2
# spark lib32gcc1 libstdc++6 libstdc++6:i386 sudo -n true
elif [ "${executable}" == "./7DaysToDie.sh" ]; then if [ $? -eq 0 ]; then
# lib32gcc1 libstdc++6 libstdc++6:i386 telnet expect fn_printinfonl "Attempting to install missing dependencies automatically"
elif [ "${executable}" == "./ucc-bin" ]; then echo -en ".\r"
sleep 1
if [ -f "${executabledir}/ucc-bin-real" ]; then echo -en "..\r"
executable=ucc-bin-real sleep 1
elif [ -f "${executabledir}/ut2004-bin" ]; then echo -en "...\r"
executable=ut2004-bin sleep 1
echo -en " \r"
sudo apt-get install ${array_deps_missing[@]}
else else
executable=ut-bin echo "sudo apt-get install ${array_deps_missing[@]}"
fi fi
else
elif [ "${executable}" == "./ts3server_startscript.sh" ]; then fn_printoknl "Checking for missing dependencies"
executable=ts3server_linux_amd64
fi fi
Loading…
Cancel
Save