Procházet zdrojové kódy

Added dev feature detect-glibc

detect-glibc will recursively check every file in $filesdir and detect
the versions of GLIBC that are required. This will make is easy to
detect what version of GLIBC a server requries.
Daniel Gibbs před 9 roky
rodič
revize
6579ba1103

+ 31 - 0
lgsm/functions/command_dev_detect_detect_glibc.sh

@@ -0,0 +1,31 @@
+#!/bin/bash
+# command_dev_detect_glibc.sh function
+# Author: Daniel Gibbs
+# Website: https://gameservermanagers.com
+# Description: Automatically detects the version of GLIBC that is required.
+# Can check a file or directory recursively.
+
+echo "================================="
+echo "GLIBC Requirements Checker"
+echo "================================="
+
+if [ -z "${filesdir}" ]; then
+	dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
+fi
+
+if [ -d "${filesdir}" ]; then
+	echo "Checking directory: "
+	echo "${filesdir}"
+elif [ -f "${filesdir}" ]; then
+	echo "Checking file: "
+	echo "${filesdir}"
+fi
+echo ""
+
+find ${filesdir} -type f -print0 |
+while IFS= read -r -d $'\0' line; do
+	objdump -T $line 2>/dev/null|grep -oP "GLIBC[^ ]+" >>"${lgsmdir}/tmp"
+done
+
+cat "${lgsmdir}/tmp"|sort|uniq|sort -r --version-sort
+rm "${lgsmdir}/tmp"

+ 4 - 0
lgsm/functions/core_functions.sh

@@ -265,6 +265,10 @@ functionfile="${FUNCNAME}"
 fn_fetch_function
 fn_fetch_function
 }
 }
 
 
+command_dev_detect_glibc.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
 
 
 # Fix
 # Fix
 
 

+ 14 - 0
lgsm/functions/core_getopt.sh

@@ -43,6 +43,8 @@ case "${getopt}" in
 		fn_autoinstall;;
 		fn_autoinstall;;
 	dd|depsdetect)
 	dd|depsdetect)
 		command_dev_detect_deps.sh;;
 		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
 	*)
 	*)
 	if [ -n "${getopt}" ]; then
 	if [ -n "${getopt}" ]; then
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
@@ -103,6 +105,8 @@ case "${getopt}" in
 		fn_autoinstall;;
 		fn_autoinstall;;
 	dd|depsdetect)
 	dd|depsdetect)
 		command_dev_detect_deps.sh;;
 		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
 	*)
 	*)
 	if [ -n "${getopt}" ]; then
 	if [ -n "${getopt}" ]; then
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
@@ -156,6 +160,8 @@ case "${getopt}" in
 		command_install.sh;;
 		command_install.sh;;
 	dd|depsdetect)
 	dd|depsdetect)
 		command_dev_detect_deps.sh;;
 		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
 	*)
 	*)
 	if [ -n "${getopt}" ]; then
 	if [ -n "${getopt}" ]; then
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
@@ -218,6 +224,8 @@ case "${getopt}" in
 		fn_autoinstall;;
 		fn_autoinstall;;
 	dd|depsdetect)
 	dd|depsdetect)
 		command_dev_detect_deps.sh;;
 		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
 	fd|fastdl)
 	fd|fastdl)
 		command_fastdl.sh;;
 		command_fastdl.sh;;
 	*)
 	*)
@@ -283,6 +291,8 @@ case "${getopt}" in
 		compress_ut99_maps.sh;;
 		compress_ut99_maps.sh;;
 	dd|depsdetect)
 	dd|depsdetect)
 		command_dev_detect_deps.sh;;
 		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
 	*)
 	*)
 	if [ -n "${getopt}" ]; then
 	if [ -n "${getopt}" ]; then
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
@@ -349,6 +359,8 @@ case "${getopt}" in
 		fn_autoinstall;;
 		fn_autoinstall;;
 	dd|depsdetect)
 	dd|depsdetect)
 		command_dev_detect_deps.sh;;
 		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
 	mc|map-compressor)
 	mc|map-compressor)
 		compress_unreal2_maps.sh;;
 		compress_unreal2_maps.sh;;
 	*)
 	*)
@@ -417,6 +429,8 @@ case "${getopt}" in
 		compress_unreal2_maps.sh;;
 		compress_unreal2_maps.sh;;
 	dd|depsdetect)
 	dd|depsdetect)
 		command_dev_detect_deps.sh;;
 		command_dev_detect_deps.sh;;
+	dg|detect-glibc)
+		command_dev_detect_glibc.sh;;
 	*)
 	*)
 	if [ -n "${getopt}" ]; then
 	if [ -n "${getopt}" ]; then
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"
 		echo -e "${red}Unknown command${default}: $0 ${getopt}"