Просмотр исходного кода

Added hidden depdetect

Dep detect to detect dependences required by the server binary. This is
a hidden option for now. still in development.
Daniel Gibbs 11 лет назад
Родитель
Сommit
6c41e10015
3 измененных файлов с 56 добавлено и 3 удалено
  1. 35 0
      functions/fn_deps_detect
  2. 8 2
      functions/fn_functions
  3. 13 1
      functions/fn_getopt

+ 35 - 0
functions/fn_deps_detect

@@ -0,0 +1,35 @@
+#!/bin/bash
+# LGSM fn_dep_detect function
+# Author: Daniel Gibbs
+# Website: http://gameservermanagers.com
+# Version: 200615
+
+# Description: Detects dependencies the server binary requires.
+
+local modulename="Backup"
+fn_check_root
+fn_check_systemdir
+cd ${executabledir}
+readelf -d ${executable} |grep NEEDED|awk '{ print $5 }'|sed 's/\[//g'|sed 's/\]//g' > ${rootdir}/.depdetect_readelf
+
+
+echo "yum install " > ${rootdir}/.depdetect_centos
+echo "apt-get install " > ${rootdir}/.depdetect_ubuntu
+echo "apt-get install " > ${rootdir}/.depdetect_debian
+while read lib; do
+	sharedlib=${lib}
+	if [ ${lib} == "libm.so.6" ]||[ ${lib} == "libc.so.6" ]||[ ${lib} == "libpthread.so.0" ]||[ ${lib} == "libdl.so.2" ]||[ ${lib} == "libnsl.so.1" ];then
+		echo "glibc.i386" >> ${rootdir}/.depdetect_centos_list
+		echo "lib32gcc1" >> ${rootdir}/.depdetect_ubuntu_list
+		echo "lib32gcc1" >> ${rootdir}/.depdetect_debian_list
+	elif [ ${lib} == "libstdc++.so.6" ];then
+		echo "libstdc++.i686" >> ${rootdir}/.depdetect_centos_list
+		echo "libstdc++6:i386" >> ${rootdir}/.depdetect_ubuntu_list
+		echo "libstdc++6:i386" >> ${rootdir}/.depdetect_debian_list
+	else
+		echo "${lib}" >> ${rootdir}/.depdetect_unknown
+	fi
+done < ${rootdir}/.depdetect_readelf
+uniq ${rootdir}/.depdetect_centos_list > ${rootdir}/.depdetect_centos_list_uniq
+uniq ${rootdir}/.depdetect_ubuntu_list > ${rootdir}/.depdetect_ubuntu_list_uniq
+uniq ${rootdir}/.depdetect_debian_list > ${rootdir}/.depdetect_debian_list_uniq

+ 8 - 2
functions/fn_functions

@@ -2,7 +2,7 @@
 # LGSM fn_functions function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 240515
+# Version: 200615
 
 # 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.
@@ -91,6 +91,12 @@ fn_details_distro(){
 functionfile="${FUNCNAME}"
 fn_runfunction
 }
+
+fn_deps_detect(){
+functionfile="${FUNCNAME}"
+fn_runfunction
+}
+
 fn_email(){
 functionfile="${FUNCNAME}"
 fn_runfunction
@@ -294,4 +300,4 @@ fn_runfunction
 }
 
 # Calls on-screen messages
-fn_messages
+fn_messages

+ 13 - 1
functions/fn_getopt

@@ -2,7 +2,7 @@
 # LGSM fn_getopt function
 # Author: Daniel Gibbs
 # Website: http://gameservermanagers.com
-# Version: 250515
+# Version: 200615
 
 # Description: getopt arguments.
 
@@ -42,6 +42,8 @@ case "$getopt" in
 		fn_install;;
 	auto-install)
 		fn_autoinstall;;
+	depdetect)
+		fn_deps_detect;;		
 	*)
 	echo "Usage: $0 {start|stop|restart|update|force-update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install}"
 	exit 1;;
@@ -73,6 +75,8 @@ case "$getopt" in
 		fn_install;;
 	auto-install)
 		fn_autoinstall;;
+	depdetect)
+		fn_deps_detect;;		
 	*)
 		echo "Usage: $0 {start|stop|restart|update|update-functions|monitor|email-test|details|backup|install|auto-install}"
 		exit 1;;
@@ -100,6 +104,8 @@ case "$getopt" in
 		fn_console;;
 	debug)
 		fn_debug;;
+	depdetect)
+		fn_deps_detect;;		
 	*)
 		echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|backup|console|debug}"
 		exit 1;;
@@ -133,6 +139,8 @@ case "$getopt" in
 		fn_install;;
 	map-compressor)
 		fn_compress_ut99maps;;
+	depdetect)
+		fn_deps_detect;;		
 	*)
 	echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
 	exit 1;;
@@ -179,6 +187,8 @@ case "$getopt" in
 		fn_autoinstall;;
 	map-compressor)
 		fn_compress_unreal2maps;;
+	depdetect)
+		fn_deps_detect;;		
 	*)
 	echo "Usage: $0 {start|stop|restart|update|update-functions|validate|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
 	exit 1;;
@@ -213,6 +223,8 @@ case "$getopt" in
 		fn_install;;
 	map-compressor)
 		fn_compress_unreal2maps;;
+	depdetect)
+		fn_deps_detect;;		
 	*)
 	echo "Usage: $0 {start|stop|restart|update-functions|monitor|email-test|details|backup|console|debug|install|map-compressor}"
 	exit 1;;