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..459916d6d --- /dev/null +++ b/lgsm/config-default/config-lgsm/ecoserver/_default.cfg @@ -0,0 +1,116 @@ +################################## +######## 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 #### + +## 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 ./EcoServer.exe" +servercfg="Network.eco" +servercfgdefault="Network.eco" +servercfgdir="${systemdir}/Configs" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## 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 4dae26adc..397da4f75 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 021898b43..b998f8ed1 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 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 0.5 + if [ -n monocheck ]; then + fn_add_mono_repo + fi + sleep 0.5 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 diff --git a/lgsm/functions/command_monitor.sh b/lgsm/functions/command_monitor.sh index f68fa2e33..1febd053a 100644 --- a/lgsm/functions/command_monitor.sh +++ b/lgsm/functions/command_monitor.sh @@ -186,7 +186,7 @@ if [ "${gamename}" == "Starbound" ]; then if [ "${queryenabled}" == "true" ]; then fn_monitor_query fi -elif [ "${gamename}" == "TeamSpeak 3" ]; then +elif [ "${gamename}" == "TeamSpeak 3" ]||[ "${gamename}" == "Eco" ]; then fn_monitor_query_telnet else fn_monitor_query diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index bacd0fbb3..72738f00d 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -252,6 +252,34 @@ fn_info_config_dontstarve(){ fi } +fn_info_config_eco(){ + if [ ! -f "${servercfgfullpath}" ]; then + servername="${unavailable}" + serverpassword="${unavailable}" + maxplayers="${zero}" + gamemode="${unavailable}" + tickrate="${zero}" + port="${zero}" + webadminport="${zero}" + public="" + else + servername=$(grep "Description" "${servercfgdir}/Network.eco" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/Description//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + serverpassword=$(grep "Password" "${servercfgdir}/Network.eco" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + maxplayers=$(grep "MaxConnections" "${servercfgdir}/Network.eco" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/MaxConnections//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + port=$(grep "\"GameServerPort\"" "${servercfgdir}/Network.eco" | tr -cd '[:digit:]') + webadminport=$(grep "\"WebServerPort\"" "${servercfgdir}/Network.eco" | tr -cd '[:digit:]') + public=$(grep "PublicServer" "${servercfgdir}/Network.eco" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/PublicServer//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//') + + # Not Set + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET"} + maxplayers=${maxplayers=:-"0"} + port=${port=:-"0"} + webadminport=${webadminport=:-"0"} + public=${public=:-"NOT SET"} + fi +} + fn_info_config_factorio(){ if [ ! -f "${servercfgfullpath}" ]; then servername="Factorio Server" @@ -1020,6 +1048,9 @@ elif [ "${gamename}" == "Call of Duty: World at War" ]; then # Dont Starve Together elif [ "${engine}" == "dontstarve" ]; then fn_info_config_dontstarve +# Eco +elif [ "${shortname}" == "eco" ]; then + fn_info_config_eco # Factorio elif [ "${gamename}" == "Factorio" ]; then fn_info_config_factorio diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index b2c125fc1..52083921c 100644 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -438,7 +438,7 @@ fn_info_message_ports(){ parmslocation="${red}UNKNOWN${default}" # engines/games that require editing in the config file - local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" ) + local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "seriousengine35" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" ) for port_edit in "${ports_edit_array[@]}" do if [ "${shortname}" == "ut3" ]; then @@ -616,6 +616,16 @@ fn_info_message_dontstarve(){ } | column -s $'\t' -t } +fn_info_message_eco(){ + echo -e "netstat -atunp | grep mono" + echo -e "" + { + echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL" + echo -e "> Game\tINBOUND\t${port}\tudp" + echo -e "> WebAdmin\tINBOUND\t${webadminport}\ttcp" + } | column -s $'\t' -t +} + fn_info_message_factorio(){ echo -e "netstat -atunp | grep factorio" echo -e "" @@ -1082,6 +1092,8 @@ fn_info_message_select_engine(){ fn_info_message_cod4 elif [ "${gamename}" == "Call of Duty: World at War" ]; then fn_info_message_codwaw + elif [ "${gamename}" == "Eco" ]; then + fn_info_message_eco elif [ "${gamename}" == "ET: Legacy" ]; then fn_info_message_etlegacy elif [ "${gamename}" == "Factorio" ]; then diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh index f1c5d81fc..f1ecf21f7 100644 --- a/lgsm/functions/info_parms.sh +++ b/lgsm/functions/info_parms.sh @@ -41,6 +41,11 @@ fn_info_parms_dst(){ cave=${cave:-"NOT SET"} } +fn_info_parms_eco(){ + queryport=${webadminport} +} + + fn_info_parms_factorio(){ port=${port:-"0"} rconport=${rconport:-"0"} @@ -147,6 +152,9 @@ elif [ "${engine}" == "realvirtuality" ]; then # Call of Duty elif [ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${engine}" == "iw2.0" ]||[ "${engine}" == "iw3.0" ]; then fn_info_parms_cod +# Eco +elif [ "${gamename}" == "Eco" ]; then + fn_info_parms_eco # Factorio elif [ "${gamename}" == "Factorio" ]; then fn_info_parms_factorio