Browse Source

IP address is selected in config for some games

If server has multiple nic's then an ip has to be selected. Some servers
this is done on the parms and others in the config.

LGSM now handles config IP addresses better. Check IP also tells the
user to change the IP in the config
pull/1128/head
Daniel Gibbs 9 years ago
parent
commit
dc0a7cab43
  1. 8
      lgsm/functions/check_ip.sh
  2. 56
      lgsm/functions/info_config.sh

8
lgsm/functions/check_ip.sh

@ -16,7 +16,7 @@ if [ "${gamename}" != "TeamSpeak 3" ] && [ "${gamename}" != "Mumble" ]; then
fi
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
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
if [ "${getipwc}" -ge "2" ]; then
fn_print_dots "Check IP"
@ -24,8 +24,14 @@ if [ "${gamename}" != "TeamSpeak 3" ] && [ "${gamename}" != "Mumble" ]; then
fn_print_fail "Check IP: Multiple active network interfaces found."
sleep 1
echo -en "\n"
if [ "${ipsetinconfig}" == "1" ]; then
fn_print_information "Specify the IP you want to use within the server config file ${servercfg}.\n"
echo -en "${servercfgfullpath}\n"
echo -en "Set ${ipinconfigvar} to one of the following:\n"
else
fn_print_information "Specify the IP you want to use within the ${selfname} script.\n"
echo -en "Set ip=\"0.0.0.0\" to one of the following:\n"
fi
echo -en "${getip}\n"
echo -en ""
echo -en "https://gameservermanagers.com/network-interfaces\n"

56
lgsm/functions/info_config.sh

@ -33,11 +33,9 @@ fn_info_config_avalanche(){
slots=${slots:-"0"}
port=${port:-"0"}
# check if the ip exists in the config file. Failing this will fall back to the default.
ipconfigcheck=$(grep "BindIP" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/BindIP//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
ip=$(grep "BindIP" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/BindIP//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="BindIP"
fi
}
@ -62,11 +60,9 @@ fn_info_config_bf1942(){
slots=${slots:-"0"}
port=${port:-"0"}
# check if the ip exists in the config file. Failing this will fall back to the default.
ipconfigcheck=$(grep "game.serverIP" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/game.serverIP//g' | tr -d '=\";,:' | xargs)
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
ip=$(grep "game.serverIP" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/game.serverIP//g' | tr -d '=\";,:' | xargs)
ipsetinconfig=1
ipinconfigvar="game.serverIP"
fi
}
@ -125,11 +121,9 @@ fn_info_config_minecraft(){
gamemode=${gamemode:-"NOT SET"}
gameworld=${gameworld:-"NOT SET"}
# check if the ip exists in the config file. Failing this will fall back to the default.
ipconfigcheck=$(grep "server-ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/server-ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
ip=$(grep "server-ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/server-ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="server-ip"
fi
}
@ -176,10 +170,10 @@ fn_info_config_quakelive(){
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
slots=${slots:-"0"}
ipconfigcheck=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
ip=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="set net_ip"
fi
}
@ -204,10 +198,10 @@ fn_info_config_wolfensteinenemyterritory(){
serverpassword=${serverpassword:-"NOT SET"}
slots=${slots:-"0"}
port=${port:-"27960"}
ipconfigcheck=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
ip=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="set net_ip"
fi
}
@ -314,11 +308,9 @@ fn_info_config_teamspeak3(){
queryport=${queryport:-"10011"}
fileport=${fileport:-"30033"}
# check if the ip exists in the config file. Failing this will fall back to the default.
ipconfigcheck=$(grep "voice_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/voice_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
ip=$(grep "voice_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/voice_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="voice_ip"
fi
}
@ -336,11 +328,9 @@ fn_info_config_mumble(){
queryport=${queryport:-"64738"}
servername="Mumble Port ${port}"
# check if the ip exists in the config file. Failing this will fall back to the default.
ipconfigcheck=$(cat "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^;/d' -e 's/voice_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
if [ -n "${ipconfigcheck}" ]; then
ip="${ipconfigcheck}"
fi
ip=$(cat "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^;/d' -e 's/voice_ip//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
ipsetinconfig=1
ipinconfigvar="voice_ip"
fi
}

Loading…
Cancel
Save