4
0
Эх сурвалжийг харах

If multiple IP addresses display as not set in details

updated if statements


Adjusted messaging 


updated if
Daniel Gibbs 7 жил өмнө
parent
commit
bb271b538f

+ 5 - 10
lgsm/functions/check_ip.sh

@@ -6,7 +6,6 @@
 # If multiple interfaces are detected the user will need to manually set using ip="0.0.0.0".
 
 local commandname="CHECK"
-local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travistest}" != "1" ]; then
 	if [ ! -f "/bin/ip" ]; then
@@ -25,14 +24,10 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
 		sleep 0.5
 		# Multiple interfaces
 		if [ "${getipwc}" -ge "2" ]; then
-		        multiple_ip=1
-		        fn_print_dots "Check IP"
-			sleep 1
-			command_arg=$(ps -o command $$ | tail -n +2 | cut -d' ' -f3)
-			if [[ "${command_arg}" = "details" ]] || [[ "${command_arg}" = "dt" ]] ; then
-			    fn_print_warn "Check IP: Multiple active network interfaces found."
+			if [ "${function_selfname}" == "command_details.sh" ]; then
+			    fn_print_warn "Check IP: Multiple IP addresses found."
 			else
-			    fn_print_fail "Check IP: Multiple active network interfaces found."
+			    fn_print_fail "Check IP: Multiple IP addresses found."
 			fi
 			sleep 0.5
 			echo -en "\n"
@@ -62,7 +57,7 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
 			echo -en "https://linuxgsm.com/network-interfaces\n"
 			echo -en ""
 			# Do not exit for details and postdetails commands
-			if [ "${commandaction}" != "Details" ]&&[ "${commandaction}" != "Postdetails" ]; then
+			if [ "${function_selfname}" != "command_details.sh" ]||[ "${function_selfname}" != "command_postdetails.sh" ]; then
 				fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
 				core_exit.sh
 			else
@@ -84,7 +79,7 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
 			fn_script_log_fatal "IP address not set in game config."
 			fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
 			fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
-			if [[ "${command_arg}" != "details" ]] && [[ "${command_arg}" != "dt" ]] ; then
+			if [ "${function_selfname}" != "command_details.sh" ];then
 			    core_exit.sh
 			fi
 		else

+ 5 - 1
lgsm/functions/info_messages.sh

@@ -139,7 +139,11 @@ fn_info_message_gameserver(){
 		fi
 
 		# Server ip
-		echo -e "${blue}Server IP:\t${default}${ip}:${port}"
+		if [ ${multiple_ip} == 1 ]; then
+		    echo -e "${blue}Server IP:\t${default}NOT SET"
+		else
+		    echo -e "${blue}Server IP:\t${default}${ip}:${port}"
+		fi
 
 		# External server ip
 		if [ -n "${extip}" ]; then