Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for config issues (ark & global) #1243

Merged
merged 15 commits into from
Jan 13, 2017
12 changes: 5 additions & 7 deletions ARKSurvivalEvolved/arkserver
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@ version="170110"
#### Server Settings ####

## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
servername="ark-server"
port="7778"
port="7777"
queryport="27015"
rconport="32330"
rconpassword="" # Set to enable rcon
maxplayers="50"
rconport="27020"
maxplayers="70"
ip="0.0.0.0"

## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
# Edit with care
fn_parms(){
parms="\"TheIsland?listen?MultiHome=${ip}?SessionName=${servername}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port}?ServerAdminPassword=${rconpassword}\""
parms="\"TheIsland?listen?MultiHome=${ip}?MaxPlayers=${maxplayers}?QueryPort=${queryport}?RCONPort=${rconport}?Port=${port}?\""
}

#### LinuxGSM Settings ####
Expand Down Expand Up @@ -82,7 +80,7 @@ githubbranch="master"

## LinuxGSM Server Details
# Do not edit
gamename="ARK: Survivial Evolved"
gamename="ARK: Survival Evolved"
engine="unreal4"

## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
Expand Down
11 changes: 8 additions & 3 deletions lgsm/functions/command_details.sh
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,14 @@ fn_details_ark(){
echo -e "netstat -atunp | grep ShooterGame"
echo -e ""
{
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE"
echo -e "> Game\tINBOUND\t${port}\tudp\tPort=${port}"
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game\tINBOUND\t${port}\tudp"
# Don't do arithmetics if ever the port wasn't a numeric value
if [ "${port}" -eq "${port}" ]; then
echo -e "> RAW\tINBOUND\t$((port+1))\tudp"
fi
echo -e "> Query\tINBOUND\t${queryport}\tudp"
echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
} | column -s $'\t' -t
}

Expand Down Expand Up @@ -772,7 +777,7 @@ fn_display_details() {
fn_details_ut3
elif [ "${gamename}" == "7 Days To Die" ]; then
fn_details_sdtd
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
fn_details_ark
elif [ "${gamename}" == "Call of Duty" ]; then
fn_details_cod
Expand Down
2 changes: 1 addition & 1 deletion lgsm/functions/command_stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ fn_stop_tmux(){
rm -f "${rootdir}/${lockselfname}"
# ARK doesn't clean up immediately after tmux is killed.
# Make certain the ports are cleared before continuing.
if [ "${gamename}" == "ARK: Survivial Evolved" ]; then
if [ "${gamename}" == "ARK: Survival Evolved" ]; then
fn_stop_ark
echo -en "\n"
fi
Expand Down
15 changes: 14 additions & 1 deletion lgsm/functions/info_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ fn_info_config_avalanche(){
fi
}

fn_info_config_ark(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
else
servername=$(grep "SessionName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/SessionName//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
# Not Set
servername=${servername:-"NOT SET"}
fi
}

fn_info_config_bf1942(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
Expand Down Expand Up @@ -596,6 +606,9 @@ fn_info_config_sdtd(){
# Just Cause 2
if [ "${engine}" == "avalanche" ]; then
fn_info_config_avalanche
# ARK: Survival Evolved
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
fn_info_config_ark
# Battlefield: 1942
elif [ "${gamename}" == "Battlefield: 1942" ]; then
fn_info_config_bf1942
Expand Down Expand Up @@ -663,4 +676,4 @@ elif [ "${gamename}" == "7 Days To Die" ]; then
fn_info_config_sdtd
elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_info_config_wolfensteinenemyterritory
fi
fi
74 changes: 39 additions & 35 deletions lgsm/functions/install_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,7 @@ local commandname="INSTALL"
local commandaction="Install"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"

fn_fetch_default_config(){
mkdir -pv "${lgsmdir}/default-configs"
githuburl="https://github.com/GameServerManagers/Game-Server-Configs/master"

for config in "${array_configs[@]}"
do
fileurl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master/${gamedirname}/${config}"; filedir="${lgsmdir}/default-configs"; filename="${config}"; executecmd="noexecute" run="norun"; force="noforce"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
done
}

# Changes some variables within the default configs
# SERVERNAME to LinuxGSM
# PASSWORD to random password
fn_set_config_vars(){
random=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 8 | tr -d '\n'; echo)
servername="LinuxGSM"
rconpass="admin$random"
echo "changing hostname."
fn_script_log_info "changing hostname."
sleep 1
sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}"
echo "changing rcon/admin password."
fn_script_log_info "changing rcon/admin password."
sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}"
sleep 1
}

# Checks if cfg dir exists, creates it if it doesn't
# Checks if server cfg dir exists, creates it if it doesn't
fn_check_cfgdir(){
if [ ! -d "${servercfgdir}" ]; then
echo "creating ${servercfgdir} config directory."
Expand All @@ -45,11 +17,19 @@ fn_check_cfgdir(){
fi
}

# Copys the default configs from Game-Server-Configs repo to the
# correct location
# Downloads default configs from Game-Server-Configs repo to lgsm/default-configs
fn_fetch_default_config(){
mkdir -pv "${lgsmdir}/default-configs"
githuburl="https://github.com/GameServerManagers/Game-Server-Configs/master"
for config in "${array_configs[@]}"; do
fileurl="https://raw.githubusercontent.com/GameServerManagers/Game-Server-Configs/master/${gamedirname}/${config}"; filedir="${lgsmdir}/default-configs"; filename="${config}"; executecmd="noexecute" run="norun"; force="noforce"
fn_fetch_file "${fileurl}" "${filedir}" "${filename}" "${executecmd}" "${run}" "${force}" "${md5}"
done
}

# Copys default configs from Game-Server-Configs repo to server config location
fn_default_config_remote(){
for config in "${array_configs[@]}"
do
for config in "${array_configs[@]}"; do
# every config is copied
echo "copying ${config} config file."
fn_script_log_info "copying ${servercfg} config file."
Expand All @@ -66,6 +46,29 @@ fn_default_config_remote(){
sleep 1
}

# Changes some variables within the default configs
# SERVERNAME to LinuxGSM
# PASSWORD to random password
fn_set_config_vars(){
if [ -f "${servercfgfullpath}" ]; then
random=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 8 | tr -d '\n'; echo)
servername="LinuxGSM"
rconpass="admin$random"
echo "changing hostname."
fn_script_log_info "changing hostname."
sleep 1
sed -i "s/SERVERNAME/${servername}/g" "${servercfgfullpath}"
echo "changing rcon/admin password."
fn_script_log_info "changing rcon/admin password."
sed -i "s/ADMINPASSWORD/${rconpass}/g" "${servercfgfullpath}"
sleep 1
else
fn_script_log_warn "Config file not found, cannot alter it."
echo "Config file not found, cannot alter it."
sleep 1
fi
}

# Changes some variables within the default Don't Starve Together configs
fn_set_dst_config_vars(){
## cluster.ini
Expand Down Expand Up @@ -127,8 +130,9 @@ if [ "${gamename}" == "7 Days To Die" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
elif [ "${gamename}" == "ARK: Survival Evolved" ]; then
gamedirname="ARKSurvivalEvolved"
fn_check_cfgdir
array_configs+=( GameUserSettings.ini )
fn_fetch_default_config
fn_default_config_remote
Expand Down Expand Up @@ -494,4 +498,4 @@ elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
fn_fetch_default_config
fn_default_config_remote
fn_set_config_vars
fi
fi