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

fix(ut2k4): depricate dependencys for ut2k4 and ut99 (#3309)

* removed ut2k4 and ut99 dependencys and tmux detection refactor
Daniel Gibbs 5 лет назад
Родитель
Сommit
8582b0a629

+ 0 - 24
lgsm/functions/check_deps.sh

@@ -441,18 +441,6 @@ fn_deps_build_debian(){
 	# Sven Co-op
 	elif [ "${shortname}" == "sven" ]; then
 		array_deps_required+=( libssl1.1:i386 zlib1g:i386 )
-	# Unreal Engine
-	elif [ "${executable}" == "./ucc-bin" ]; then
-		# UT2K4
-		if [ -f "${executabledir}/ut2004-bin" ]; then
-			array_deps_required+=( libsdl1.2debian libstdc++5:i386 )
-		# UT99
-		else
-			array_deps_required+=( libsdl1.2debian )
-		fi
-	# Unreal Tournament
-	elif [ "${shortname}" == "ut" ]; then
-		array_deps_required+=( unzip )
 	# Vintage Story
 	elif [ "${shortname}" == "vints" ]; then
 		array_deps_required+=( mono-complete )
@@ -556,18 +544,6 @@ fn_deps_build_redhat(){
 	# Sven Co-op
 	elif [ "${shortname}" == "sven" ]; then
 		: # not compatible
-	# Unreal Engine
-	elif [ "${executable}" == "./ucc-bin" ]; then
-		# UT2K4
-		if [ -f "${executabledir}/ut2004-bin" ]; then
-			array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 )
-		# UT99
-		else
-			array_deps_required+=( SDL.i686 bzip2 )
-		fi
-	# Unreal Tournament
-	elif [ "${shortname}" == "ut" ]; then
-		array_deps_required+=( unzip )
 	# Vintage Story
 	elif [ "${shortname}" == "vints" ]; then
 		array_deps_required+=( mono-complete )

+ 10 - 14
lgsm/functions/command_start.sh

@@ -82,26 +82,22 @@ fn_start_tmux(){
 	# Create last start lock file
 	date +%s > "${lockdir}/${selfname}-laststart.lock"
 
-	# Get tmux version.
-	tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p')
-	# Tmux compiled from source will return "master", therefore ignore it.
-	if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p')" == "master" ]; then
-		fn_script_log "Tmux version: master (user compiled)"
-		echo -e "Tmux version: master (user compiled)" >> "${consolelog}"
+	# tmux compiled from source will return "master", therefore ignore it.
+	if [ "${tmuxv}" == "master" ]; then
+		fn_script_log "tmux version: master (user compiled)"
+		echo -e "tmux version: master (user compiled)" >> "${consolelog}"
 		if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then
 			tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
 		fi
-	elif [ "${tmuxversion}" ]; then
-		# Get the digit version of tmux.
-		tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')
+	elif [ -n "${tmuxv}" ]; then
 		# tmux pipe-pane not supported in tmux versions < 1.6.
-		if [ "${tmuxversion}" -lt "16" ]; then
-			echo -e "Console logging disabled: Tmux => 1.6 required
+		if [ "${tmuxvdigit}" -lt "16" ]; then
+			echo -e "Console logging disabled: tmux => 1.6 required
 			https://linuxgsm.com/tmux-upgrade
 			Currently installed: $(tmux -V)" > "${consolelog}"
 
 		# Console logging disabled: Bug in tmux 1.8 breaks logging.
-		elif [ "${tmuxversion}" -eq "18" ]; then
+		elif [ "${tmuxvdigit}" -eq "18" ]; then
 			echo -e "Console logging disabled: Bug in tmux 1.8 breaks logging
 			https://linuxgsm.com/tmux-upgrade
 			Currently installed: $(tmux -V)" > "${consolelog}"
@@ -127,8 +123,8 @@ fn_start_tmux(){
 		fn_print_fail_nl "Unable to start ${servername}"
 		fn_script_log_fatal "Unable to start ${servername}"
 		if [ -s "${lgsmlogdir}/.${selfname}-tmux-error.tmp" ]; then
-			fn_print_fail_nl "Unable to start ${servername}: Tmux error:"
-			fn_script_log_fatal "Unable to start ${servername}: Tmux error:"
+			fn_print_fail_nl "Unable to start ${servername}: tmux error:"
+			fn_script_log_fatal "Unable to start ${servername}: tmux error:"
 			echo -e ""
 			echo -e "Command"
 			echo -e "================================="

+ 6 - 13
lgsm/functions/info_distro.sh

@@ -8,10 +8,6 @@
 
 functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
-### Game Server pid
-if [ "${status}" == "1" ]; then
-	gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')
-fi
 ### Distro information
 
 ## Distro
@@ -70,15 +66,12 @@ done
 glibcversion=$(ldd --version | sed -n '1s/.* //p')
 
 ## tmux version
-# e.g: tmux 1.6
-if [ ! "$(command -V tmux 2>/dev/null)" ]; then
-	tmuxv="${red}NOT INSTALLED!${default}"
-else
-	if [ "$(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)
-	fi
+tmuxv=$(tmux -V | sed "s/tmux //")
+tmuxvdigit=$(echo "${tmuxv}" | tr -cd '[:digit:]')
+
+## Game Server pid
+if [ "${status}" == "1" ]&&[ "${tmuxv}" != "1.8" ]; then
+	gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}" | grep "^${sessionname} " | awk '{print $NF}')
 fi
 
 ## Uptime

+ 10 - 2
lgsm/functions/info_messages.sh

@@ -137,8 +137,16 @@ fn_info_message_gameserver_resource(){
 	fn_messages_separator
 	{
 		if [ "${status}" != "0" ]; then
-			echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}"
-			echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}MB${default}"
+			if [ -n "${cpuused}" ]; then
+				echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}"
+			else
+				echo -e "${lightblue}CPU Used:\t${red}unknown${default}"
+			fi
+			if [ -n "${memused}" ]; then
+				echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}MB${default}"
+			else
+				echo -e "${lightblue}Mem Used:\t${default}${pmemused}\t${red}unknown${default}"
+			fi
 		else
 			echo -e "${lightblue}CPU Used:\t${default}0%${default}"
 			echo -e "${lightblue}Mem Used:\t${default}0%\t0MB${default}"