From 1e91dda915c72d9c04daa211e1470f453100b30e Mon Sep 17 00:00:00 2001 From: Glenn Kintscher Date: Thu, 29 Mar 2018 16:29:28 +0200 Subject: [PATCH] Add Eco server --- .../config-lgsm/ecoserver/_default.cfg | 117 ++++++++++++++++++ lgsm/data/serverlist.csv | 1 + lgsm/functions/check_deps.sh | 65 ++++++++++ 3 files changed, 183 insertions(+) create mode 100644 lgsm/config-default/config-lgsm/ecoserver/_default.cfg diff --git a/lgsm/config-default/config-lgsm/ecoserver/_default.cfg b/lgsm/config-default/config-lgsm/ecoserver/_default.cfg new file mode 100644 index 000000000..7e5f185b5 --- /dev/null +++ b/lgsm/config-default/config-lgsm/ecoserver/_default.cfg @@ -0,0 +1,117 @@ +################################## +######## Default Settings ######## +################################## +# DO NOT EDIT WILL BE OVERWRITTEN! +# Copy settings from here and use them in either +# common.cfg - applies settings to every instance +# [instance].cfg - applies settings to a specific instance + +#### Server Settings #### + +## SteamCMD Login | https://github.com/GameServerManagers/LinuxGSM/wiki/SteamCMD#steamcmd-login +steamuser="username" +steampass='password' + +## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters +fn_parms(){ + parms="-nogui" +} + +#### LinuxGSM Settings #### + +## Notification Alerts +# (on|off) + +# More info | https://github.com/GameServerManagers/LinuxGSM/wiki/Alerts#more-info +postalert="off" +postdays="7" +posttarget="https://hastebin.com" + +# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord +discordalert="off" +discordwebhook="webhook" + +# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email +emailalert="off" +email="email@example.com" +emailfrom="" + +# IFTTT Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/IFTTT +iftttalert="off" +ifttttoken="accesstoken" +iftttevent="linuxgsm_alert" + +# Mailgun Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/mailgun +mailgunalert="off" +mailguntoken="accesstoken" +mailgundomain="example.com" +mailgunemailfrom="alert@example.com" +mailgunemail="email@myemail.com" + +# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet +pushbulletalert="off" +pushbullettoken="accesstoken" +channeltag="" + +# Pushover Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover +pushoveralert="off" +pushovertoken="accesstoken" + +# Telegram Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Telegram +telegramalert="off" +telegramtoken="accesstoken" +telegramchatid="" + +## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update +updateonstart="off" + +## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup +maxbackups="4" +maxbackupdays="30" +stoponbackup="on" + +## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging +consolelogging="on" +logdays="7" + +#### LinuxGSM Advanced Settings #### + +## SteamCMD Settings +# Server appid +appid="739590" +# Steam App Branch Select +# Allows to opt into the various Steam app branches. Default branch is "". +# Example: "-beta 7.3.0" +branch="" + +## LinuxGSM Server Details +# Do not edit +gamename="Eco" +engine="unity3d" + +#### Directories #### +# Edit with care + +## Server Specific Directories +systemdir="${serverfiles}" +executabledir="${serverfiles}" +executable="mono ${serverfiles}/EcoServer.exe" +# TODO: Add config stuff + +## Backup Directory +backupdir="${rootdir}/backups" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${logdir}/server" +lgsmlogdir="${logdir}/script" +consolelogdir="${logdir}/console" +lgsmlog="${lgsmlogdir}/${servicename}-script.log" +consolelog="${consolelogdir}/${servicename}-console.log" +alertlog="${lgsmlogdir}/${servicename}-alert.log" +postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log" + +## Logs Naming +lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" +consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" +gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index 7f81f81fb..687357cfc 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -24,6 +24,7 @@ doi,doiserver,Day of Infamy dmc,dmcserver,Deathmatch Classic dst,dstserver,Don't Starve Together dab,dabserver,Double Action: Boogaloo +eco,ecoserver,Eco em,emserver,Empires Mod fctr,fctrserver,Factorio fof,fofserver,Fistful of Frags diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index e296c33de..65f008052 100644 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -6,6 +6,52 @@ local commandname="CHECK" +fn_add_mono_repo(){ + # TODO: Detect correct distro and version for source url + if [ "${monocheck}" != "0" ]; then + fn_print_dots_nl "Adding Mono repository" + sleep 0.5 + sudo -v > /dev/null 2>&1 + if [ $? -eq 0 ]; then + fn_print_information_nl "Automatically adding repository." + fn_script_log_info "Automatically adding repository." + echo -en ".\r" + sleep 1 + echo -en "..\r" + sleep 1 + echo -en "...\r" + sleep 1 + echo -en " \r" + if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + cmd="sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && echo 'deb http://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list && sudo apt-get update" + eval ${cmd} + elif [ -n "$(command -v yum 2>/dev/null)" ]; then + cmd="rpm --import 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF' && su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'" + eval ${cmd} + fi + if [ $? != 0 ]; then + fn_print_failure_nl "Unable to add Mono repository" + fn_script_log_fatal "Unable to add Mono repository" + exit 1 + else + fn_print_complete_nl "Add Mono repository completed" + fn_script_log_pass "Add Mono repository completed" + fi + else + echo "" + fn_print_warning_nl "$(whoami) does not have sudo access. Manually add Mono repository." + fn_script_log_warn "$(whoami) does not have sudo access. Manually add Mono repository." + if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then + echo " sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && echo 'deb http://download.mono-project.com/repo/ubuntu stable-xenial main' | sudo tee /etc/apt/sources.list.d/mono-official-stable.list && sudo apt-get update" + elif [ -n "$(command -v yum 2>/dev/null)" ]; then + echo " rpm --import 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF' && su -c 'curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo'" + fi + echo "" + exit 1 + fi + fi +} + fn_deps_detector(){ # Checks if dependency is missing if [ "${tmuxcheck}" == "1" ]; then @@ -18,6 +64,15 @@ fn_deps_detector(){ depstatus=0 deptocheck="${javaversion}" unset javacheck + elif [ "${deptocheck}" == "mono-complete" ]; then + if [[ -n "$(mono --version)" && "$(mono --version 2>&1 | grep -Po '(?<=version )\d')" -ge 5 ]]; then + # Mono >= 5.0.0 already installed + depstatus=0 + else + # Mono not installed or installed Mono < 5.0.0 + depstatus=1 + monocheck=1 + fi elif [ -n "$(command -v apt-get 2>/dev/null)" ]; then dpkg-query -W -f='${Status}' ${deptocheck} 2>/dev/null | grep -q -P '^install ok installed' depstatus=$? @@ -78,6 +133,10 @@ fn_found_missing_deps(){ fn_print_error_nl "Checking dependencies: missing: ${red}${array_deps_missing[@]}${default}" fn_script_log_error "Checking dependencies: missing: ${array_deps_missing[@]}" sleep 1 + if [ -n monocheck ]; then + fn_add_mono_repo + fi + sleep 1 sudo -v > /dev/null 2>&1 if [ $? -eq 0 ]; then fn_print_information_nl "Automatically installing missing dependencies." @@ -227,6 +286,9 @@ if [ -n "$(command -v dpkg-query 2>/dev/null)" ]; then # Unreal Tournament elif [ "${gamename}" == "Unreal Tournament" ]; then array_deps_required+=( unzip ) + # Eco + elif [ "${gamename}" == "Eco" ]; then + array_deps_required+=( mono-complete ) fi fn_deps_email fn_check_loop @@ -316,6 +378,9 @@ elif [ -n "$(command -v yum 2>/dev/null)" ]; then # Unreal Tournament elif [ "${gamename}" == "Unreal Tournament" ]; then array_deps_required+=( unzip ) + # Eco + elif [ "${gamename}" == "Eco" ]; then + array_deps_required+=( mono-complete ) fi fn_deps_email fn_check_loop