Browse Source

Always return ip 0.0.0.0

pull/2101/head
Josh 7 years ago
parent
commit
a70f1497ae
  1. 166
      lgsm/functions/check_ip.sh

166
lgsm/functions/check_ip.sh

@ -7,86 +7,88 @@
local commandname="CHECK" local commandname="CHECK"
if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travistest}" != "1" ]; then ip=0.0.0.0
if [ ! -f "/bin/ip" ]; then
ipcommand="/sbin/ip"
else
ipcommand="ip"
fi
getip=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|sort -u|grep -v 127.0.0)
getipwc=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|sort -u|grep -vc 127.0.0)
info_config.sh
info_parms.sh
# IP is not set to specific IP # if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travistest}" != "1" ]; then
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then # if [ ! -f "/bin/ip" ]; then
fn_print_dots "Check IP" # ipcommand="/sbin/ip"
sleep 0.2 # else
# Multiple interfaces # ipcommand="ip"
if [ "${getipwc}" -ge "2" ]; then # fi
if [ "${function_selfname}" == "command_details.sh" ]; then # getip=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|sort -u|grep -v 127.0.0)
fn_print_warn "Check IP: Multiple IP addresses found." # getipwc=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|sort -u|grep -vc 127.0.0)
else # info_config.sh
fn_print_fail "Check IP: Multiple IP addresses found." # info_parms.sh
fi
sleep 0.2 # # IP is not set to specific IP
echo -en "\n" # if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
# IP is set within game config # fn_print_dots "Check IP"
if [ "${ipsetinconfig}" == "1" ]; then # sleep 0.2
fn_print_information "Specify the IP you want to bind within ${servercfg}.\n" # # Multiple interfaces
echo -en " * location: ${servercfgfullpath}\n" # if [ "${getipwc}" -ge "2" ]; then
echo -en "\n" # if [ "${function_selfname}" == "command_details.sh" ]; then
echo -en "Set ${ipinconfigvar} to one of the following:\n" # fn_print_warn "Check IP: Multiple IP addresses found."
fn_script_log_fatal "Multiple IP addresses found." # else
fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}." # fn_print_fail "Check IP: Multiple IP addresses found."
# IP is set within LinuxGSM config # fi
else # sleep 0.2
fn_print_information_nl "Specify the IP you want to bind within a LinuxGSM config file.\n" # echo -en "\n"
echo -en " * location: ${configdirserver}\n" # # IP is set within game config
echo -en "\n" # if [ "${ipsetinconfig}" == "1" ]; then
echo -en "Set ip=\"0.0.0.0\" to one of the following:\n" # fn_print_information "Specify the IP you want to bind within ${servercfg}.\n"
fn_script_log_fatal "Multiple IP addresses found." # echo -en " * location: ${servercfgfullpath}\n"
if [ "${legacymode}" == "1" ]; then # echo -en "\n"
fn_script_log_fatal "Specify the IP you want to bind within the ${selfname} script." # echo -en "Set ${ipinconfigvar} to one of the following:\n"
else # fn_script_log_fatal "Multiple IP addresses found."
fn_script_log_fatal "Specify the IP you want to bind within: ${configdirserver}." # fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
fi # # IP is set within LinuxGSM config
fi # else
echo -en "${getip}\n" # fn_print_information_nl "Specify the IP you want to bind within a LinuxGSM config file.\n"
echo -en "\n" # echo -en " * location: ${configdirserver}\n"
echo -en "https://linuxgsm.com/network-interfaces\n" # echo -en "\n"
echo -en "" # echo -en "Set ip=\"0.0.0.0\" to one of the following:\n"
# Do not exit for details and postdetails commands # fn_script_log_fatal "Multiple IP addresses found."
if [ "${function_selfname}" != "command_details.sh" ]||[ "${function_selfname}" != "command_postdetails.sh" ]; then # if [ "${legacymode}" == "1" ]; then
fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n" # fn_script_log_fatal "Specify the IP you want to bind within the ${selfname} script."
core_exit.sh # else
else # fn_script_log_fatal "Specify the IP you want to bind within: ${configdirserver}."
ip="NOT SET" # fi
fi # fi
# Single interface # echo -en "${getip}\n"
elif [ "${ipsetinconfig}" == "1" ]; then # echo -en "\n"
fn_print_fail "Check IP: IP address not set in game config." # echo -en "https://linuxgsm.com/network-interfaces\n"
sleep 0.5 # echo -en ""
echo -en "\n" # # Do not exit for details and postdetails commands
fn_print_information "Specify the IP you want to bind within ${servercfg}.\n" # if [ "${function_selfname}" != "command_details.sh" ]||[ "${function_selfname}" != "command_postdetails.sh" ]; then
echo -en " * location: ${servercfgfullpath}\n" # fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
echo -en "\n" # core_exit.sh
echo -en "Set ${ipinconfigvar} to the following:\n" # else
echo -en "${getip}\n" # ip="NOT SET"
echo -en "\n" # fi
echo -en "https://linuxgsm.com/network-interfaces\n" # # Single interface
echo -en "" # elif [ "${ipsetinconfig}" == "1" ]; then
fn_script_log_fatal "IP address not set in game config." # fn_print_fail "Check IP: IP address not set in game config."
fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}." # sleep 0.5
fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n" # echo -en "\n"
if [ "${function_selfname}" != "command_details.sh" ];then # fn_print_information "Specify the IP you want to bind within ${servercfg}.\n"
core_exit.sh # echo -en " * location: ${servercfgfullpath}\n"
fi # echo -en "\n"
else # echo -en "Set ${ipinconfigvar} to the following:\n"
fn_print_info_nl "Check IP: ${getip}" # echo -en "${getip}\n"
fn_script_log_info "IP automatically set as: ${getip}" # echo -en "\n"
sleep 0.2 # echo -en "https://linuxgsm.com/network-interfaces\n"
ip="${getip}" # echo -en ""
fi # fn_script_log_fatal "IP address not set in game config."
fi # fn_script_log_fatal "Specify the IP you want to bind within: ${servercfgfullpath}."
fi # fn_script_log_fatal "https://linuxgsm.com/network-interfaces\n"
# 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}"
# sleep 0.2
# ip="${getip}"
# fi
# fi
# fi

Loading…
Cancel
Save