Ver Fonte

Initial code to detect missing deps

This code is still broken
Daniel Gibbs há 10 anos atrás
pai
commit
10dbf68f17
3 ficheiros alterados com 70 adições e 2 exclusões
  1. 9 1
      functions/check.sh
  2. 55 0
      functions/check_deps.sh
  3. 6 1
      functions/core_functions.sh

+ 9 - 1
functions/check.sh

@@ -2,7 +2,7 @@
 # LGSM fn_check function
 # LGSM fn_check function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="060116"
+lgsm_version="170116"
 
 
 # Description: Overall function for managing checks.
 # Description: Overall function for managing checks.
 # Runs checks that will either halt on or fix an issue.
 # Runs checks that will either halt on or fix an issue.
@@ -33,6 +33,14 @@ do
 	fi
 	fi
 done
 done
 
 
+local allowed_commands_array=( command_debug.sh command_start.sh command_stop.sh )
+for allowed_command in "${allowed_commands_array[@]}"
+do
+	if [ "${allowed_command}" == "${function_selfname}" ]; then
+		check_deps.sh
+	fi
+done
+
 local allowed_commands_array=( command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh )
 local allowed_commands_array=( command_debug.sh command_details.sh command_monitor.sh command_start.sh command_stop.sh )
 for allowed_command in "${allowed_commands_array[@]}"
 for allowed_command in "${allowed_commands_array[@]}"
 do
 do

+ 55 - 0
functions/check_deps.sh

@@ -0,0 +1,55 @@
+#!/bin/bash
+# LGSM check_deps.sh function
+# Author: Daniel Gibbs
+# Website: http://gameservermanagers.com
+
+# Description: Checks that the require dependencies are installed for LGSM
+
+
+fn_deps_detector(){
+if [ -n "$(command -v dpkg-query)" ]; then
+	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=$?	
+else
+	echo "Unknown OS"
+fi
+
+}
+
+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
+
+elif [ "${executable}" ==  "./ts3server_startscript.sh" ]; then
+	executable=ts3server_linux_amd64	
+fi

+ 6 - 1
functions/core_functions.sh

@@ -2,7 +2,7 @@
 # LGSM core_functions.sh function
 # LGSM core_functions.sh function
 # Author: Daniel Gibbs
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
 # Website: http://gameservermanagers.com
-lgsm_version="060116"
+lgsm_version="170116"
 
 
 # Description: Defines all functions to allow download and execution of functions using fn_runfunction.
 # Description: Defines all functions to allow download and execution of functions using fn_runfunction.
 # This function is called first before any other function. Without this file other functions would not load.
 # This function is called first before any other function. Without this file other functions would not load.
@@ -111,6 +111,11 @@ functionfile="${FUNCNAME}"
 fn_runfunction
 fn_runfunction
 }
 }
 
 
+check_deps.sh(){
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
 check_ip.sh(){
 check_ip.sh(){
 functionfile="${FUNCNAME}"
 functionfile="${FUNCNAME}"
 fn_runfunction
 fn_runfunction