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

Merge pull request #2044 from GameServerManagers/feature/issue-1385

Details will no longer exit if multple ip addresses are found
Daniel Gibbs 7 лет назад
Родитель
Сommit
c08ec43067
2 измененных файлов с 14 добавлено и 5 удалено
  1. 9 4
      lgsm/functions/check_ip.sh
  2. 5 1
      lgsm/functions/info_messages.sh

+ 9 - 4
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,7 +24,11 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
 		sleep 0.5
 		# Multiple interfaces
 		if [ "${getipwc}" -ge "2" ]; then
-			fn_print_fail "Check IP: Multiple IP addresses found."
+			if [ "${function_selfname}" == "command_details.sh" ]; then
+			    fn_print_warn "Check IP: Multiple IP addresses found."
+			else
+			    fn_print_fail "Check IP: Multiple IP addresses found."
+			fi
 			sleep 0.5
 			echo -en "\n"
 			# IP is set within game config
@@ -54,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
@@ -76,7 +79,9 @@ 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"
-			core_exit.sh
+			if [ "${function_selfname}" != "command_details.sh" ];then
+			    core_exit.sh
+			fi
 		else
 			fn_print_info_nl "Check IP: ${getip}"
 			fn_script_log_info "IP automatically set as: ${getip}"

+ 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