Browse Source

Fixed issue identifying ip not being set in game config if 1 IP

if server has single IP and required IP to be specified in game config check_ip was not detecting the issue
pull/1787/head
Daniel Gibbs 7 years ago
parent
commit
efbbe41865
  1. 55
      lgsm/functions/check_ip.sh

55
lgsm/functions/check_ip.sh

@ -17,37 +17,62 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
getip=$(${ipcommand} -o -4 addr|awk '{print $4}'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0)
getipwc=$(${ipcommand} -o -4 addr|awk '{print $4}'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -vc 127.0.0)
info_config.sh
# IP is not set to specific IP
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
fn_print_dots "Check IP"
sleep 1
# Multiple interfaces
if [ "${getipwc}" -ge "2" ]; then
fn_print_dots "Check IP"
sleep 1
fn_print_fail "Check IP: Multiple active network interfaces found."
fn_print_fail "Check IP: Multiple IP addresses found."
sleep 1
echo -en "\n"
# IP is set within game config
if [ "${ipsetinconfig}" == "1" ]; then
fn_print_information "Specify the IP you want to use within the game server config file ${servercfg}.\n"
echo -en "${servercfgfullpath}\n"
fn_print_information "Specify the IP you want to bind within ${servercfg}.\n"
echo -en " * location: ${servercfgfullpath}\n"
echo -en "\n"
echo -en "Set ${ipinconfigvar} to one of the following:\n"
fn_script_log_fatal "Multiple IP addresses found."
fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
# IP is set within LinuxGSM config
else
fn_print_information_nl "Specify the IP you want to use within a LinuxGSM config file."
echo -en "location: ${configdirserver}\n"
echo ""
fn_print_information_nl "Specify the IP you want to bind within a LinuxGSM config file.\n"
echo -en " * location: ${configdirserver}\n"
echo -en "\n"
echo -en "Set ip=\"0.0.0.0\" to one of the following:\n"
fn_script_log_fatal "Multiple IP addresses found."
if [ "${legacymode}" == "1" ]; then
fn_script_log_fatal "Specify the IP you want to bind within the ${selfname} script."
else
fn_script_log_fatal "Specify the IP you want to bind within: ${configdirserver}."
fi
fi
echo -en "${getip}\n"
echo -en "\n"
echo -en "https://gameservermanagers.com/network-interfaces\n"
echo -en ""
fn_script_log_fatal "https://gameservermanagers.com/network-interfaces\n"
core_exit.sh
# Single interface
elif [ "${ipsetinconfig}" == "1" ]; then
fn_print_fail "Check IP: IP address not set in game config."
sleep 1
echo -en "\n"
fn_print_information "Specify the IP you want to bind within ${servercfg}.\n"
echo -en " * location: ${servercfgfullpath}\n"
echo -en "\n"
echo -en "Set ${ipinconfigvar} to the following:\n"
echo -en "${getip}\n"
echo -en "\n"
echo -en "https://gameservermanagers.com/network-interfaces\n"
echo -en ""
fn_script_log_fatal "Multiple active network interfaces found."
if [ "${legacymode}" == "1" ]; then
fn_script_log_fatal "Manually specify the IP you want to use within the ${selfname} script."
else
fn_script_log_fatal "Manually specify the IP you want to use within: ${configdirserver}."
fi
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://gameservermanagers.com/network-interfaces\n"
core_exit.sh
else
ip=${getip}
ip="${getip}"
fi
fi
fi

Loading…
Cancel
Save