Browse Source

Merge pull request #573 from dgibbs64/hurt-world

added hurt world
pull/582/head
Daniel Gibbs 9 years ago
parent
commit
0c2334dc5d
  1. 152
      Hurtworld/hwserver
  2. 63
      functions/fn_details
  3. 52
      functions/fn_details_config
  4. 2
      functions/fn_install
  5. 15
      functions/fn_install_config
  6. 4
      functions/fn_install_gsquery
  7. 9
      functions/fn_install_steamfix
  8. 5
      functions/fn_monitor_query

152
Hurtworld/hwserver

@ -0,0 +1,152 @@
#!/bin/bash
# Hurtworld
# Server Management Script
# Author: Daniel Gibbs,
# Contributor: UltimateByte
# Website: http://gameservermanagers.com
if [ -f ".dev-debug" ]; then
exec 5>dev-debug.log
BASH_XTRACEFD="5"
set -x
fi
version="191215"
#### Variables ####
# Notification Email
# (on|off)
emailnotification="off"
email="[email protected]"
# Steam login
steamuser="anonymous"
steampass=""
# Server settings
servername="Hurtworld LGSM Server"
ip="0.0.0.0"
port="12871"
queryport="12881"
maxplayers="20"
map="" #Optional
creativemode="0" #Free Build
logfile="gamelog.txt"
# Adding admins using STEAMID64
# Example : addadmin 012345678901234567; addadmin 987654321098765432
admins=""
# Advanced
# Rollback server state (remove after start command)
loadsave=""
# Use unstable 64 bit server executable (O/1)
x64mode="0"
# http://hurtworld.wikia.com/wiki/Hosting_A_Server
fn_parms(){
parms="-batchmode -nographics -exec \"host ${port} ${map} ${loadsave};queryport ${queryport};maxplayers ${maxplayers};servername ${servername};creativemode ${creativemode};${admins}\" -logfile \"${logfile}\" "
}
#### Advanced Variables ####
# Github Branch Select
# Allows for the use of different function files
# from a different repo and/or branch.
githubuser="dgibbs64"
githubrepo="linuxgsm"
githubbranch="hurt-world"
# Steam
appid="405100"
# Server Details
servicename="hurtworld-server"
gamename="Hurtworld"
engine="unity3d"
# Directories
rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
lockselfname=".${servicename}.lock"
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
if [ "${x64mode}" == "1" ]; then
executable="./Hurtworld.x86_64"
else
executable="./Hurtworld.x86"
fi
backupdir="${rootdir}/backups"
# Logging
logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
gamelog="${gamelogdir}/${servicename}-game.log"
scriptlog="${scriptlogdir}/${servicename}-script.log"
consolelog="${consolelogdir}/${servicename}-console.log"
emaillog="${scriptlogdir}/${servicename}-email.log"
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
##### Script #####
# Do not edit
fn_getgithubfile(){
filename=$1
exec=$2
fileurl=${3:-$filename}
filepath="${rootdir}/${filename}"
filedir=$(dirname "${filepath}")
# If the function file is missing, then download
if [ ! -f "${filepath}" ]; then
if [ ! -d "${filedir}" ]; then
mkdir "${filedir}"
fi
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
echo -e " fetching ${filename}...\c"
if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
:
else
echo -e "\e[0;31mFAIL\e[0m\n"
echo "Curl is not installed!"
echo -e ""
exit
fi
curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
if [ $? -ne 0 ]; then
echo -e "\e[0;31mFAIL\e[0m\n"
echo " ${curl}"|grep "curl:"
echo -e "${githuburl}\n"
exit
else
echo -e "\e[0;32mOK\e[0m"
fi
if [ "${exec}" ]; then
chmod +x "${filepath}"
fi
fi
if [ "${exec}" ]; then
source "${filepath}"
fi
}
fn_runfunction(){
fn_getgithubfile "functions/${functionfile}" 1
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
getopt=$1
fn_getopt

63
functions/fn_details

@ -554,7 +554,7 @@ echo -e ""
fn_details_statusbottom fn_details_statusbottom
} }
fn_details_unity3d(){ fn_details_sdtd(){
fn_check_ip fn_check_ip
fn_parms fn_parms
fn_details_config fn_details_config
@ -601,6 +601,37 @@ printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
fn_details_statusbottom fn_details_statusbottom
} }
fn_details_hurtworld(){
fn_check_ip
fn_parms
fn_details_config
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
fn_details_commandlineparms
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the parameters in"
echo -e "hwserver script"
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep Hurtworld.x86"
echo -e ""
{
echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
echo -e "> Game/RCON\tINBOUND\t${port}\tudp"
echo -e "> Query\tINBOUND\t${queryport}\tudp"
} | column -s $'\t' -t
echo -e ""
fn_details_statusbottom
}
fn_details_unreal(){ fn_details_unreal(){
fn_check_ip fn_check_ip
fn_parms fn_parms
@ -688,17 +719,19 @@ fn_details_statusbottom
} }
if [ ! -e "${servercfgfullpath}" ]; then if [ ! -e "${servercfgfullpath}" ]; then
echo "" if [ "${gamename}" != "Hurtworld" ]; then
fn_printwarnnl "\e[0;31mCONFIGURATION FILE MISSING!\e[0m" echo ""
echo "${servercfgfullpath}" fn_printwarnnl "\e[0;31mCONFIGURATION FILE MISSING!\e[0m"
echo "Some details cannot be displayed" echo "${servercfgfullpath}"
echo -en ".\r" echo "Some details cannot be displayed"
sleep 1 echo -en ".\r"
echo -en "..\r" sleep 1
sleep 1 echo -en "..\r"
echo -en "...\r" sleep 1
sleep 1 echo -en "...\r"
echo -en " \r" sleep 1
echo -en " \r"
fi
fi fi
fn_details_glibc fn_details_glibc
@ -723,12 +756,14 @@ elif [ "${engine}" == "teeworlds" ]; then
fn_details_teeworlds fn_details_teeworlds
elif [ "${engine}" == "terraria" ]; then elif [ "${engine}" == "terraria" ]; then
fn_details_terraria fn_details_terraria
elif [ "${engine}" == "unity3d" ]; then
fn_details_unity3d
elif [ "${engine}" == "unreal" ] || [ "${engine}" == "unreal2" ]; then elif [ "${engine}" == "unreal" ] || [ "${engine}" == "unreal2" ]; then
fn_details_unreal fn_details_unreal
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
fn_details_ark fn_details_ark
elif [ "${gamename}" == "Hurtworld" ]; then
fn_details_hurtworld
elif [ "${gamename}" == "7 Days To Die" ]; then
fn_details_sdtd
elif [ "${gamename}" == "Teamspeak 3" ]; then elif [ "${gamename}" == "Teamspeak 3" ]; then
fn_details_teamspeak3 fn_details_teamspeak3
else else

52
functions/fn_details_config

@ -235,6 +235,7 @@ elif [ "${engine}" == "realvirtuality" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# Serious Sam
elif [ "${engine}" == "seriousengine35" ]; then elif [ "${engine}" == "seriousengine35" ]; then
# server name # server name
@ -295,6 +296,7 @@ elif [ "${engine}" == "seriousengine35" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# Source Engine Games
elif [ "${engine}" == "source" ] || [ "${engine}" == "goldsource" ]; then elif [ "${engine}" == "source" ] || [ "${engine}" == "goldsource" ]; then
# server name # server name
@ -329,6 +331,7 @@ elif [ "${engine}" == "source" ] || [ "${engine}" == "goldsource" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# Spark (NS2: Combat)
elif [ "${engine}" == "spark" ]; then elif [ "${engine}" == "spark" ]; then
# query port # query port
@ -341,6 +344,7 @@ elif [ "${engine}" == "spark" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# Teamspeak 3
elif [ "${gamename}" == "Teamspeak 3" ]; then elif [ "${gamename}" == "Teamspeak 3" ]; then
# ip # ip
@ -388,6 +392,7 @@ elif [ "${gamename}" == "Teamspeak 3" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# Teeworlds
elif [ "${engine}" == "teeworlds" ]; then elif [ "${engine}" == "teeworlds" ]; then
# server name # server name
@ -440,6 +445,7 @@ elif [ "${engine}" == "teeworlds" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# Terraria
elif [ "${engine}" == "terraria" ]; then elif [ "${engine}" == "terraria" ]; then
# port # port
@ -450,7 +456,8 @@ elif [ "${engine}" == "terraria" ]; then
port="0" port="0"
fi fi
elif [ "${engine}" == "unity3d" ]; then # 7 Day To Die (unity3d)
elif [ "${gamename}" == "7 Days To Die" ]; then
# server name # server name
if [ -f "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then
@ -586,6 +593,48 @@ elif [ "${engine}" == "unity3d" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# Hurtworld (unity3d)
elif [ "${gamename}" == "Hurtworld" ]; then
# server name
if [ -n "${servername}" ]; then
servername="${servername}"
else
servername="\e[0;31mUNAVAILABLE\e[0m"
fi
# server password
# not available yet
# slots
if [ -n "${maxplayers}" ]; then
slots="${maxplayers}"
else
slots="NOT SET"
fi
# game world
if [ -n "${map}" ]; then
gameworld="${map}"
else
gameworld="NO MAP SET"
fi
# port
if [ -n "${port}" ]; then
port="${port}"
else
port="0"
fi
# query port
if [ -n "${queryport}" ]; then
queryport="${queryport}"
else
queryport="0"
fi
# Unreal Tournament
elif [ "${engine}" == "unreal" ] || [ "${engine}" == "unreal2" ]; then elif [ "${engine}" == "unreal" ] || [ "${engine}" == "unreal2" ]; then
# server name # server name
@ -716,6 +765,7 @@ elif [ "${engine}" == "unreal" ] || [ "${engine}" == "unreal2" ]; then
fn_servercfgfullpath fn_servercfgfullpath
# ARK: Survivaial Evolved
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then
# server name # server name

2
functions/fn_install

@ -43,4 +43,4 @@ elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
elif [ "${gamename}" == "Unreal Tournament 99" ]; then elif [ "${gamename}" == "Unreal Tournament 99" ]; then
fn_install_ut99fix fn_install_ut99fix
fi fi
fn_install_complete fn_install_complete

15
functions/fn_install_config

@ -5,9 +5,9 @@
lgsm_version="201215" lgsm_version="201215"
fn_defaultconfig(){ fn_defaultconfig(){
echo "creating ${servercfg} config file." echo "creating ${servercfg} config file."
cp -v "${servercfgdefault}" "${servercfgfullpath}" cp -v "${servercfgdefault}" "${servercfgfullpath}"
sleep 1 sleep 1
} }
fn_userinputconfig(){ fn_userinputconfig(){
@ -151,12 +151,15 @@ echo ""
} }
echo "" echo ""
if [ "${gamename}" != "Hurtworld" ]; then
echo "Creating Configs" echo "Creating Configs"
echo "=================================" echo "================================="
sleep 1 sleep 1
mkdir -pv "${servercfgdir}" mkdir -pv "${servercfgdir}"
cd "${servercfgdir}" cd "${servercfgdir}"
githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}" githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}"
fi
if [ "${gamename}" == "7 Days To Die" ]; then if [ "${gamename}" == "7 Days To Die" ]; then
fn_defaultconfig fn_defaultconfig
elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then elif [ "${gamename}" == "ARK: Survivial Evolved" ]; then

4
functions/fn_install_gsquery

@ -2,7 +2,7 @@
# LGSM fn_install_gsquery function # LGSM fn_install_gsquery function
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Website: http://gameservermanagers.com # Website: http://gameservermanagers.com
lgsm_version="061115" lgsm_version="221215"
fn_dlgsquery(){ fn_dlgsquery(){
cd "${rootdir}" cd "${rootdir}"
@ -11,7 +11,7 @@ wget -N /dev/null "http://gameservermanagers.com/dl/gsquery.py" 2>&1 | grep -F "
chmod +x gsquery.py chmod +x gsquery.py
} }
if [ "${engine}" == "avalanche" ]||[ "${engine}" == "goldsource" ]||[ "${engine}" == "realvirtuality" ]||[ "${engine}" == "source" ]||[ "${engine}" == "spark" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then if [ "${engine}" == "avalanche" ]||[ "${engine}" == "goldsource" ]||[ "${engine}" == "realvirtuality" ]||[ "${engine}" == "source" ]||[ "${engine}" == "spark" ]||[ "${engine}" == "unity3d" ]||[ "${gamename}" == "Hurtworld" ]||[ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
echo "" echo ""
echo "GameServerQuery" echo "GameServerQuery"
echo "============================" echo "============================"

9
functions/fn_install_steamfix

@ -14,10 +14,10 @@ cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamcl
sleep 1 sleep 1
} }
# Gary's Mod Specific # Server specific
fn_libsteamfix(){ fn_libsteamfix(){
echo "" echo ""
echo "Applying libsteam.so fix" echo "Applying libsteam.so and steamclient.so fixes"
echo "=================================" echo "================================="
sleep 1 sleep 1
if [ "${gamename}" == "Garry's Mod" ]; then if [ "${gamename}" == "Garry's Mod" ]; then
@ -26,11 +26,14 @@ if [ "${gamename}" == "Garry's Mod" ]; then
elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
mkdir -pv "${HOME}/.steam/bin32" mkdir -pv "${HOME}/.steam/bin32"
cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so" cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so"
elif [ "${gamename}" == "Hurtworld" ]; then
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86/steamclient.so"
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${filesdir}/Hurtworld_Data/Plugins/x86_64/steamclient.so"
fi fi
sleep 1 sleep 1
} }
fn_steamclientfix fn_steamclientfix
if [ "${gamename}" == "Garry's Mod" ]||[ "${gamename}" == "Serious Sam 3: BFE" ]; then if [ "${gamename}" == "Garry's Mod" ]||[ "${gamename}" == "Serious Sam 3: BFE" ]||[ "${gamename}" == "Hurtworld" ]; then
fn_libsteamfix fn_libsteamfix
fi fi

5
functions/fn_monitor_query

@ -17,9 +17,12 @@ if [ -f "${rootdir}/gsquery.py" ]; then
elif [ "${engine}" == "realvirtuality" ]; then elif [ "${engine}" == "realvirtuality" ]; then
queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd '[:digit:]') queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd '[:digit:]')
port=${queryport} port=${queryport}
elif [ "${engine}" == "unity3d" ]; then elif [ "${gamename}" == "7 Days To Die" ]; then
gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd '[:digit:]') gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd '[:digit:]')
port=$((${gameport} + 1)) port=$((${gameport} + 1))
elif [ "${gamename}" == "Hurtworld" ]; then
gameport="${port}"
port="${queryport}"
fi fi
fn_printinfo "Detected gsquery.py" fn_printinfo "Detected gsquery.py"
fn_scriptlog "Detected gsquery.py" fn_scriptlog "Detected gsquery.py"

Loading…
Cancel
Save