Selaa lähdekoodia

Merge pull request #981 from dgibbs64/development

check_deps.sh improvements
Daniel Gibbs 9 vuotta sitten
vanhempi
commit
801605e292

+ 1 - 1
lgsm/functions/alert_email.sh

@@ -32,7 +32,7 @@ fn_details_os(){
 		echo -e ""
 		echo -e "Distro Details"
 		echo -e "================================="
-		echo -e "Distro: ${os}"
+		echo -e "Distro: ${distroname}"
 		echo -e "Arch: ${arch}"
 		echo -e "Kernel: ${kernel}"
 		echo -e "Hostname: $HOSTNAME"

+ 24 - 7
lgsm/functions/check_deps.sh

@@ -9,7 +9,7 @@ local commandname="CHECK"
 fn_deps_detector(){
 	# Checks if dependency is missing
 	if [ -n "$(command -v dpkg-query)" ]; then
-		dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null| grep -q -P '^install ok installed$'
+		dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null | grep -q -P '^install ok installed$'
 		depstatus=$?
 	elif [ -n "$(command -v yum)" ]; then
 		yum -q list installed ${deptocheck} > /dev/null 2>&1
@@ -18,6 +18,11 @@ fn_deps_detector(){
 	if [ "${depstatus}" == "0" ]; then
 		missingdep=0
 		if [ "${function_selfname}" == "command_install.sh" ]; then
+			if [ "${tmuxcheck}" != "1" ]; then
+				# Added for users compiling tmux from source to bypass rpm check
+				echo -e "${green}tmux${default}"
+				tmuxcheck=1
+			fi
 			echo -e "${green}${deptocheck}${default}"
 			sleep 0.5
 		fi
@@ -133,11 +138,15 @@ if [ -n "$(command -v dpkg-query)" ]; then
 	array_deps_missing=()
 
 	# LGSM requirements
-	array_deps_required=( curl ca-certificates file bsdmainutils util-linux python )
+	array_deps_required=( curl ca-certificates file bsdmainutils util-linux python bzip2 gzip )
 
 	# All servers except ts3 require tmux
 	if [ "${executable}" != "./ts3server_startscript.sh" ]; then
-		array_deps_required+=( tmux )
+		if [ "$(command -v tmux)" ]||[ "$(which tmux)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
+			: # Added for users compiling tmux from source to bypass rpm check
+		else
+			array_deps_required+=( tmux )
+		fi
 	fi
 
 	# All servers except ts3 & mumble require libstdc++6, lib32gcc1
@@ -165,7 +174,7 @@ if [ -n "$(command -v dpkg-query)" ]; then
 		array_deps_required+=( libcurl4-gnutls-dev:i386 )
 	# Project Zomboid
 	elif [ "${engine}" ==  "projectzomboid" ]; then
-		array_deps_required+=( openjdk-7-jre )
+		array_deps_required+=( default-jdk )
 	# Unreal engine
 	elif [ "${executable}" ==  "./ucc-bin" ]; then
 		#UT2K4
@@ -184,11 +193,19 @@ elif [ -n "$(command -v yum)" ]; then
 	array_deps_missing=()
 
 	# LGSM requirements
-	array_deps_required=( curl util-linux python file )
+	if [ "${distroversion}" == "6" ]; then
+		array_deps_required=( curl util-linux-ng python file gzip bzip2 )
+	else
+		array_deps_required=( curl util-linux python file gzip bzip2 )
+	fi
 
 	# All servers except ts3 require tmux
 	if [ "${executable}" != "./ts3server_startscript.sh" ]; then
-		array_deps_required+=( tmux )
+		if [ "$(command -v tmux)" ]||[ "$(which tmux)" ]||[ -f "/usr/bin/tmux" ]||[ -f "/bin/tmux" ]; then
+			: # Added for users compiling tmux from source to bypass rpm check
+		else
+			array_deps_required+=( tmux )
+		fi
 	fi
 
 	# All servers excelts ts3 & mumble require glibc.i686 libstdc++.i686
@@ -212,7 +229,7 @@ elif [ -n "$(command -v yum)" ]; then
 		array_deps_required+=( libcurl.i686 )
 	# Project Zomboid
 	elif [ "${engine}" ==  "projectzomboid" ]; then
-		array_deps_required+=( java-1.7.0-openjdk )
+		array_deps_required+=( java-1.8.0-openjdk )
 	# Unreal Engine
 	elif [ "${executable}" ==  "./ucc-bin" ]; then
 		#UT2K4

+ 1 - 1
lgsm/functions/command_debug.sh

@@ -28,7 +28,7 @@ echo ""
 echo "${gamename} Debug"
 echo "================================="
 echo ""
-echo -e "Distro: ${os}"
+echo -e "Distro: ${distroname}"
 echo -e "Arch: ${arch}"
 echo -e "Kernel: ${kernel}"
 echo -e "Hostname: $HOSTNAME"

+ 1 - 1
lgsm/functions/command_details.sh

@@ -27,7 +27,7 @@ fn_details_os(){
 	echo -e "${lightyellow}Distro Details${default}"
 	printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
 	{
-		echo -e "${blue}Distro:\t${default}${os}"
+		echo -e "${blue}Distro:\t${default}${distroname}"
 		echo -e "${blue}Arch:\t${default}${arch}"
 		echo -e "${blue}Kernel:\t${default}${kernel}"
 		echo -e "${blue}Hostname:\t${default}$HOSTNAME"

+ 9 - 5
lgsm/functions/info_distro.sh

@@ -14,15 +14,19 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 arch=$(uname -m)
 kernel=$(uname -r)
 if [ -n "$(command -v lsb_release)" ]; then
-	os=$(lsb_release -s -d)
+	distroname=$(lsb_release -s -d)
+elif [ -f "/etc/os-release" ]; then
+	distroname=$(grep PRETTY_NAME /etc/os-release | sed 's/PRETTY_NAME=//g' | tr -d '="')
 elif [ -f "/etc/debian_version" ]; then
-	os="Debian $(cat /etc/debian_version)"
+	distroname="Debian $(cat /etc/debian_version)"
 elif [ -f "/etc/redhat-release" ]; then
-	os=$(cat /etc/redhat-release)
+	distroname=$(cat /etc/redhat-release)
 else
-	os="$(uname -s) $(uname -r)"
+	distroname="$(uname -s) $(uname -r)"
 fi
 
+distroversion=$(grep VERSION_ID /etc/os-release | tr -cd '[:digit:]')
+
 ## Glibc version
 # e.g: 1.17
 glibcversion="$(ldd --version | sed -n '1s/.* //p')"
@@ -31,7 +35,7 @@ glibcversion="$(ldd --version | sed -n '1s/.* //p')"
 # e.g: tmux 1.6
 if [ -z "$(command -v tmux)" ]; then
 	tmuxv="${red}NOT INSTALLED!${default}"
-elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd '[:digit:]')" -lt "16" ]; then
+elif [ "$(tmux -V|sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then
 	tmuxv="$(tmux -V) (>= 1.6 required for console log)"
 else
 	tmuxv=$(tmux -V)

+ 1 - 1
lgsm/functions/info_glibc.sh

@@ -37,7 +37,7 @@ elif [ "${engine}" == "dontstarve" ]; then
 	glibcfix="no"
 elif [ "${engine}" == "projectzomboid" ]; then
 	glibcrequired="2.15"
-	glibcfix="yesno"
+	glibcfix="no"
 elif [ "${engine}" == "realvirtuality" ]; then
 	glibcrequired="2.13"
 	glibcfix="yes"