From 05e45700e7b2b2c87ac0840630c3da2be96c1dc5 Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 10 Jan 2021 23:26:22 +0100 Subject: [PATCH] feat(newserver): SCP: Secret Laboratory (#3163) --- .../config-lgsm/scpslserver/_default.cfg | 168 ++++++++++++++++++ .../config-lgsm/scpslsmserver/_default.cfg | 168 ++++++++++++++++++ lgsm/data/serverlist.csv | 2 + lgsm/functions/check_deps.sh | 3 + lgsm/functions/info_config.sh | 22 +++ lgsm/functions/info_messages.sh | 13 +- lgsm/functions/info_parms.sh | 7 + lgsm/functions/install_config.sh | 7 + 8 files changed, 389 insertions(+), 1 deletion(-) create mode 100644 lgsm/config-default/config-lgsm/scpslserver/_default.cfg create mode 100644 lgsm/config-default/config-lgsm/scpslsmserver/_default.cfg diff --git a/lgsm/config-default/config-lgsm/scpslserver/_default.cfg b/lgsm/config-default/config-lgsm/scpslserver/_default.cfg new file mode 100644 index 0000000000..4a706ae40b --- /dev/null +++ b/lgsm/config-default/config-lgsm/scpslserver/_default.cfg @@ -0,0 +1,168 @@ +################################## +######## 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 Settings | https://docs.linuxgsm.com/configuration/start-parameters +## All server settings except the server port are done in the config file: +## Docs: https://en.scpslgame.com/index.php?title=Docs:Server_Config +port="7777" + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +parms="${port}" +} + +#### LinuxGSM Settings #### + +## Notification Alerts +# (on|off) + +# Display IP | https://docs.linuxgsm.com/alerts#display-ip +displayip="" + +# More info | https://docs.linuxgsm.com/alerts#more-info +postalert="off" +postdays="7" +posttarget="https://hastebin.com" + +# Discord Alerts | https://docs.linuxgsm.com/alerts/discord +discordalert="off" +discordwebhook="webhook" + +# Slack Alerts | https://docs.linuxgsm.com/alerts/slack +slackalert="off" +slackwebhook="webhook" + +# Email Alerts | https://docs.linuxgsm.com/alerts/email +emailalert="off" +email="email@example.com" +emailfrom="" + +# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt +iftttalert="off" +ifttttoken="accesstoken" +iftttevent="linuxgsm_alert" + +# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun +mailgunalert="off" +mailguntoken="accesstoken" +mailgundomain="example.com" +mailgunemailfrom="alert@example.com" +mailgunemail="email@myemail.com" + +# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet +pushbulletalert="off" +pushbullettoken="accesstoken" +channeltag="" + +# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover +pushoveralert="off" +pushovertoken="accesstoken" + +# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram +# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +telegramalert="off" +telegramtoken="accesstoken" +telegramchatid="" +curlcustomstring="" + +## Updating | https://docs.linuxgsm.com/commands/update +updateonstart="off" + +## Backup | https://docs.linuxgsm.com/commands/backup +maxbackups="4" +maxbackupdays="30" +stoponbackup="on" + +## Logging | https://docs.linuxgsm.com/features/logging +consolelogging="on" +logdays="7" + +## Monitor | https://docs.linuxgsm.com/commands/monitor +# Query delay time +querydelay="1" + +#### LinuxGSM Advanced Settings #### + +# ANSI Colors +ansi="on" + +# Message Display Time +sleeptime="0.5" + +# Stop Mode | https://docs.linuxgsm.com/steamcmd/stopmode +# 1: tmux kill +# 2: CTRL+c +# 3: quit +# 4: quit 120s +# 5: stop +# 6: q +# 7: exit +# 8: 7 Days to Die +# 9: Gold Source +# 10: Teamspeak 3 +stopmode="7" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="1" +querytype="" + +## Console type +consoleverbose="yes" +consoleinteract="yes" + +## SteamCMD Settings +# Server appid +appid="996560" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="" + +## LinuxGSM Server Details +# Do not edit +gamename="SCP: Secret Laboratory" +engine="unity3d" +glibc="2.27" + +#### Directories #### +# Edit with care + +## Server Specific Directories +systemdir="${serverfiles}" +executabledir="${systemdir}" +executable="./LocalAdmin" +servercfg="config_gameplay.txt" +servercfgdefault="config_gameplay.txt" +servercfgdir="${HOME}/.config/SCP Secret Laboratory/config/${port}" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${rootdir}/backups" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${HOME}/.config/SCP Secret Laboratory/LocalAdminLogs/${port}" +lgsmlogdir="${logdir}/script" +consolelogdir="${logdir}/console" +lgsmlog="${lgsmlogdir}/${selfname}-script.log" +consolelog="${consolelogdir}/${selfname}-console.log" +alertlog="${lgsmlogdir}/${selfname}-alert.log" +postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log" + +## Logs Naming +lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" +consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/config-default/config-lgsm/scpslsmserver/_default.cfg b/lgsm/config-default/config-lgsm/scpslsmserver/_default.cfg new file mode 100644 index 0000000000..4ac830f210 --- /dev/null +++ b/lgsm/config-default/config-lgsm/scpslsmserver/_default.cfg @@ -0,0 +1,168 @@ +################################## +######## 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 Settings | https://docs.linuxgsm.com/configuration/start-parameters +## All server settings except the server port are done in the config file: +## Docs: https://en.scpslgame.com/index.php?title=Docs:Server_Config +port="7777" + +## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +fn_parms(){ +parms="${port}" +} + +#### LinuxGSM Settings #### + +## Notification Alerts +# (on|off) + +# Display IP | https://docs.linuxgsm.com/alerts#display-ip +displayip="" + +# More info | https://docs.linuxgsm.com/alerts#more-info +postalert="off" +postdays="7" +posttarget="https://hastebin.com" + +# Discord Alerts | https://docs.linuxgsm.com/alerts/discord +discordalert="off" +discordwebhook="webhook" + +# Slack Alerts | https://docs.linuxgsm.com/alerts/slack +slackalert="off" +slackwebhook="webhook" + +# Email Alerts | https://docs.linuxgsm.com/alerts/email +emailalert="off" +email="email@example.com" +emailfrom="" + +# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt +iftttalert="off" +ifttttoken="accesstoken" +iftttevent="linuxgsm_alert" + +# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun +mailgunalert="off" +mailguntoken="accesstoken" +mailgundomain="example.com" +mailgunemailfrom="alert@example.com" +mailgunemail="email@myemail.com" + +# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet +pushbulletalert="off" +pushbullettoken="accesstoken" +channeltag="" + +# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover +pushoveralert="off" +pushovertoken="accesstoken" + +# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram +# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring". +# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need +# any custom string in curl - simple ignore this parameter. +telegramalert="off" +telegramtoken="accesstoken" +telegramchatid="" +curlcustomstring="" + +## Updating | https://docs.linuxgsm.com/commands/update +updateonstart="off" + +## Backup | https://docs.linuxgsm.com/commands/backup +maxbackups="4" +maxbackupdays="30" +stoponbackup="on" + +## Logging | https://docs.linuxgsm.com/features/logging +consolelogging="on" +logdays="7" + +## Monitor | https://docs.linuxgsm.com/commands/monitor +# Query delay time +querydelay="1" + +#### LinuxGSM Advanced Settings #### + +# ANSI Colors +ansi="on" + +# Message Display Time +sleeptime="0.5" + +# Stop Mode | https://docs.linuxgsm.com/steamcmd/stopmode +# 1: tmux kill +# 2: CTRL+c +# 3: quit +# 4: quit 120s +# 5: stop +# 6: q +# 7: exit +# 8: 7 Days to Die +# 9: Gold Source +# 10: Teamspeak 3 +stopmode="7" + +## Query mode +# 1: session only +# 2: gamedig + gsquery +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="1" +querytype="" + +## Console type +consoleverbose="yes" +consoleinteract="yes" + +## SteamCMD Settings +# Server appid +appid="786920" +# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch +branch="" +# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server +steammaster="" + +## LinuxGSM Server Details +# Do not edit +gamename="SCP: Secret Laboratory ServerMod" +engine="unity3d" +glibc="2.27" + +#### Directories #### +# Edit with care + +## Server Specific Directories +systemdir="${serverfiles}" +executabledir="${systemdir}" +executable="./LocalAdmin" +servercfg="config_gameplay.txt" +servercfgdefault="config_gameplay.txt" +servercfgdir="${HOME}/.config/SCP Secret Laboratory/config/${port}" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${rootdir}/backups" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${HOME}/.config/SCP Secret Laboratory/LocalAdminLogs/${port}" +lgsmlogdir="${logdir}/script" +consolelogdir="${logdir}/console" +lgsmlog="${lgsmlogdir}/${selfname}-script.log" +consolelog="${consolelogdir}/${selfname}-console.log" +alertlog="${lgsmlogdir}/${selfname}-alert.log" +postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log" + +## Logs Naming +lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log" +consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log" diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index 92f1940460..79139f6808 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -84,6 +84,8 @@ rw,rwserver,Rising World samp,sampserver,San Andreas Multiplayer sb,sbserver,Starbound sbots,sbotsserver,StickyBots +scpsl,scpslserver,SCP: Secret Laboratory +scpslsm,scpslsmserver,SCP: Secret Laboratory ServerMod sdtd,sdtdserver,7 Days to Die sfc,sfcserver,SourceForts Classic sof2,sof2server,Soldier Of Fortune 2: Gold Edition diff --git a/lgsm/functions/check_deps.sh b/lgsm/functions/check_deps.sh index 5a9b34be80..70e5f5a093 100755 --- a/lgsm/functions/check_deps.sh +++ b/lgsm/functions/check_deps.sh @@ -437,6 +437,9 @@ fn_deps_build_debian(){ else array_deps_required+=( default-jre rng-tools ) fi + # SCP: Secret Laboratory, SCP: Secret Laboratory ServerMod + elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then + array_deps_required+=( mono-complete ) # Sven Co-op elif [ "${shortname}" == "sven" ]; then array_deps_required+=( libssl1.1:i386 zlib1g:i386 ) diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 3720c421ec..ecf840961d 100755 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -1569,6 +1569,26 @@ fn_info_config_vintagestory(){ fi } +fn_info_config_scpsl(){ + if [ -f "${servercfgfullpath}" ]; then + servername=$(sed -nr 's/^server_name: (.*)$/\1/p' "${servercfgfullpath}") + maxplayers=$(sed -nr 's/^max_players: (.*)$/\1/p' "${servercfgfullpath}") + configip=$(sed -nr 's/^ipv4_bind_ip: (.*)$/\1/p' "${servercfgfullpath}") + tickrate=$(sed -nr 's/^server_tickrate: (.*)$/\1/p' "${servercfgfullpath}") + adminpassword=$(sed -nr 's/^administrator_query_password: (.*)$/\1/p' "${servercfgfullpath}") + + if [ "${adminpassword}" == "none" ]; then + adminpassword="NOT SET" + fi + else + servername=${servername:-"NOT SET"} + maxplayers=${maxplayers:-"0"} + configip=${configip:-"0.0.0.0"} + tickrate=${tickrate:-"NOT SET"} + adminpassword=${adminpassword:-"NOT SET"} + fi +} + if [ "${shortname}" == "ac" ]; then fn_info_config_assettocorsa elif [ "${shortname}" == "ark" ]; then @@ -1673,6 +1693,8 @@ elif [ "${engine}" == "unreal3" ]; then fn_info_config_unreal3 elif [ "${shortname}" == "ut" ]; then fn_info_config_ut +elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then + fn_info_config_scpsl elif [ "${shortname}" == "sdtd" ]; then fn_info_config_sdtd elif [ "${shortname}" == "wet" ]; then diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index 93dbea45be..4a834d797b 100755 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -583,7 +583,7 @@ fn_info_message_ports(){ fi done # engines/games that require editing the parms. - local ports_edit_array=( "Avorion" "col" "goldsrc" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "qfusion" "Rust" "Soldat" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned" ) + local ports_edit_array=( "Avorion" "col" "goldsrc" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "qfusion" "Rust" "scpsl" "scpslsm" "Soldat" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned" ) for port_edit in "${ports_edit_array[@]}"; do if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then parmslocation="${configdirserver}" @@ -1464,6 +1464,15 @@ fn_info_message_vintagestory(){ } | column -s $'\t' -t } +fn_info_message_scpsl(){ + echo -e "netstat -atunp | grep SCPSL" + echo -e "" + { + echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" + echo -e "> Game\tINBOUND\t${port}\tudp" + } | column -s $'\t' -t +} + fn_info_message_select_engine(){ # Display details depending on game or engine. if [ "${shortname}" == "ac" ]; then @@ -1536,6 +1545,8 @@ fn_info_message_select_engine(){ fn_info_message_quakelive elif [ "${shortname}" == "samp" ]; then fn_info_message_samp + elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then + fn_info_message_scpsl elif [ "${shortname}" == "sdtd" ]; then fn_info_message_sdtd elif [ "${shortname}" == "squad" ]; then diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh index 74c29b9df6..782f774d48 100755 --- a/lgsm/functions/info_parms.sh +++ b/lgsm/functions/info_parms.sh @@ -233,6 +233,10 @@ fn_info_parms_wf(){ webadminport=${webadminport:-"0"} } +fn_info_parms_queryport(){ + queryport="${port:-"0"}" +} + if [ "${shortname}" == "ark" ]; then fn_info_parms_ark elif [ "${shortname}" == "arma3" ]; then @@ -295,4 +299,7 @@ elif [ "${shortname}" == "ut" ]; then fn_info_parms_ut elif [ "${shortname}" == "wf" ]; then fn_info_parms_wf +# for servers that have a missing queryport from the config +elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then + fn_info_parms_queryport fi diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index 3efb46a650..dbcb27e143 100755 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -667,6 +667,13 @@ elif [ "${shortname}" == "rust" ]; then fn_fetch_default_config fn_default_config_remote fn_list_config_locations +elif [ "${shortname}" == "scpsl" ]||[ "${shortname}" == "scpslsm" ]; then + gamedirname="SCPSecretLaboratory" + array_configs+=( config_gameplay.txt config_localadmin.txt ) + fn_fetch_default_config + fn_default_config_remote + fn_set_config_vars + fn_list_config_locations elif [ "${shortname}" == "sol" ]; then gamedirname="Soldat" array_configs+=( soldat.ini )