diff --git a/lgsm/config-default/config-lgsm/arma3server/_default.cfg b/lgsm/config-default/config-lgsm/arma3server/_default.cfg index d7da37cf1..7b338811a 100644 --- a/lgsm/config-default/config-lgsm/arma3server/_default.cfg +++ b/lgsm/config-default/config-lgsm/arma3server/_default.cfg @@ -166,7 +166,7 @@ consoleinteract="no" # Do not edit gamename="ARMA 3" engine="realvirtuality" -glibc="2.13" +glibc="2.27" #### Directories #### # Edit with care diff --git a/lgsm/config-default/config-lgsm/mcbserver/_default.cfg b/lgsm/config-default/config-lgsm/mcbserver/_default.cfg index abad7f61c..d5ad3b59f 100644 --- a/lgsm/config-default/config-lgsm/mcbserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/mcbserver/_default.cfg @@ -122,7 +122,7 @@ stopmode="5" # 3: gamedig # 4: gsquery # 5: tcp -querymode="4" +querymode="2" querytype="minecraftbe" ## Console type diff --git a/lgsm/config-default/config-lgsm/pmcserver/_default.cfg b/lgsm/config-default/config-lgsm/pmcserver/_default.cfg new file mode 100644 index 000000000..8369b782c --- /dev/null +++ b/lgsm/config-default/config-lgsm/pmcserver/_default.cfg @@ -0,0 +1,173 @@ +################################## +######## Default Settings ######## +################################## +# DO NOT EDIT, ANY CHANGES 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. + +#### Game Server Settings #### + +## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters +javaram="1024" # -Xmx$1024M + +## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +startparameters="nogui" + +## Release Settings | https://docs.linuxgsm.com/game-servers/minecraft#release-settings +# Version (latest|1.16.5) +mcversion="latest" + +#### LinuxGSM Settings #### + +## LinuxGSM Stats +# Send useful stats to LinuxGSM developers. +# https://docs.linuxgsm.com/configuration/linuxgsm-stats +# (on|off) +stats="off" + +## 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" + +# Discord Alerts | https://docs.linuxgsm.com/alerts/discord +discordalert="off" +discordwebhook="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" +mailgunapiregion="us" +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" +pushoveruserkey="userkey" + +# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat +rocketchatalert="off" +rocketchatwebhook="webhook" +rocketchattoken="" + +# Slack Alerts | https://docs.linuxgsm.com/alerts/slack +slackalert="off" +slackwebhook="webhook" + +# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram +# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring". +# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help". +telegramapi="api.telegram.org" +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" + +## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors +ansi="on" + +#### Advanced Settings #### + +## Message Display Time | https://docs.linuxgsm.com/features/message-display-time +sleeptime="0.5" + +## Stop Mode | https://docs.linuxgsm.com/features/stop-mode +# 1: tmux kill +# 2: CTRL+c +# 3: quit +# 4: quit 120s +# 5: stop +# 6: q +# 7: exit +# 8: 7 Days to Die +# 9: GoldSrc +# 10: Avorion +# 11: end +stopmode="5" + +## Query mode +# 1: session only +# 2: gamedig (gsquery fallback) +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="2" +querytype="minecraft" + +## Console type +consoleverbose="yes" +consoleinteract="yes" + +## Game Server Details +# Do not edit +gamename="PaperMC" +engine="lwjgl2" +glibc="null" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${serverfiles}" +preexecutable="java -Xmx${javaram}M -jar" +executable="./paper.jar" +servercfgdir="${systemdir}" +servercfg="server.properties" +servercfgdefault="server.properties" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${systemdir}/logs" +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/rustserver/_default.cfg b/lgsm/config-default/config-lgsm/rustserver/_default.cfg index e29a2c504..c956b492c 100644 --- a/lgsm/config-default/config-lgsm/rustserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/rustserver/_default.cfg @@ -16,15 +16,18 @@ appport=28082 rconpassword="CHANGE_ME" rconweb="1" # Value is: 1 for the Facepunch web panel, Rustadmin desktop and Rustadmin Online; 0 for RCON tools like Rusty. servername="Rust" -maxplayers="50" +gamemode="vanilla" # Values: vanilla, softcore ( Doc: https://wiki.facepunch.com/rust/server-gamemodes ) +serverlevel="Procedural Map" # Values: Procedural Map, Barren, HapisIsland, SavasIsland +customlevelurl="" # Custom level url. +server.levelurl \"${customlevelurl}\" seed="" # range: 1-2147483647, used to reproduce a procedural map. salt="" # range: unknown, used to recover a known setting from an existing map. +maxplayers="50" worldsize="3000" # default: 3000, range: 1000-6000, map size in meters. saveinterval="300" # Auto-save in seconds. tickrate="30" # default: 30, range: 15-100. ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters -startparameters="-batchmode +app.listenip ${ip} +app.port ${appport} +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +server.hostname \"${servername}\" +server.identity \"${selfname}\" +server.seed ${seed} +server.salt ${salt} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.web ${rconweb} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile" +startparameters="-batchmode +app.listenip ${ip} +app.port ${appport} +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +server.hostname \"${servername}\" +server.identity \"${selfname}\" +server.gamemode ${gamemode} +server.level \"${serverlevel}\" +server.seed ${seed} +server.salt ${salt} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.web ${rconweb} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile" #### LinuxGSM Settings #### @@ -107,7 +110,7 @@ logdays="7" ## Monitor | https://docs.linuxgsm.com/commands/monitor # Query delay time -querydelay="5" +querydelay="10" ## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors ansi="on" diff --git a/lgsm/config-default/config-lgsm/vhserver/_default.cfg b/lgsm/config-default/config-lgsm/vhserver/_default.cfg index 818040bd3..096faf2a4 100644 --- a/lgsm/config-default/config-lgsm/vhserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/vhserver/_default.cfg @@ -18,7 +18,7 @@ public="1" savedir="$HOME/.config/unity3d/IronGate/Valheim" ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters -startparameters="-name \"${servername}\" -password \"${serverpassword}\" -port ${port} -world \"${gameworld}\" -public ${public} -savedir \"${savedir}\"" +startparameters="-name '${servername}' -password ${serverpassword} -port ${port} -world ${gameworld} -public ${public} -savedir '${savedir}'" #### LinuxGSM Settings #### diff --git a/lgsm/config-default/config-lgsm/wmcserver/_default.cfg b/lgsm/config-default/config-lgsm/wmcserver/_default.cfg new file mode 100644 index 000000000..b0df8cbfd --- /dev/null +++ b/lgsm/config-default/config-lgsm/wmcserver/_default.cfg @@ -0,0 +1,173 @@ +################################## +######## Default Settings ######## +################################## +# DO NOT EDIT, ANY CHANGES 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. + +#### Game Server Settings #### + +## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters +javaram="1024" # -Xmx$1024M + +## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters +startparameters="nogui" + +## Release Settings | https://docs.linuxgsm.com/game-servers/minecraft#release-settings +# Version (latest|1.16.5) +mcversion="latest" + +#### LinuxGSM Settings #### + +## LinuxGSM Stats +# Send useful stats to LinuxGSM developers. +# https://docs.linuxgsm.com/configuration/linuxgsm-stats +# (on|off) +stats="off" + +## 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" + +# Discord Alerts | https://docs.linuxgsm.com/alerts/discord +discordalert="off" +discordwebhook="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" +mailgunapiregion="us" +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" +pushoveruserkey="userkey" + +# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat +rocketchatalert="off" +rocketchatwebhook="webhook" +rocketchattoken="" + +# Slack Alerts | https://docs.linuxgsm.com/alerts/slack +slackalert="off" +slackwebhook="webhook" + +# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram +# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring". +# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help". +telegramapi="api.telegram.org" +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" + +## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors +ansi="on" + +#### Advanced Settings #### + +## Message Display Time | https://docs.linuxgsm.com/features/message-display-time +sleeptime="0.5" + +## Stop Mode | https://docs.linuxgsm.com/features/stop-mode +# 1: tmux kill +# 2: CTRL+c +# 3: quit +# 4: quit 120s +# 5: stop +# 6: q +# 7: exit +# 8: 7 Days to Die +# 9: GoldSrc +# 10: Avorion +# 11: end +stopmode="2" + +## Query mode +# 1: session only +# 2: gamedig (gsquery fallback) +# 3: gamedig +# 4: gsquery +# 5: tcp +querymode="2" +querytype="minecraft" + +## Console type +consoleverbose="yes" +consoleinteract="yes" + +## Game Server Details +# Do not edit +gamename="WaterfallMC" +engine="lwjgl2" +glibc="null" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${serverfiles}" +preexecutable="java -Xmx${javaram}M -jar" +executable="./waterfall.jar" +servercfgdir="${systemdir}" +servercfg="config.yml" +servercfgdefault="config.yml" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +logdir="${rootdir}/log" +gamelogdir="${systemdir}/logs" +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/bo_header.jpg b/lgsm/data/bo_header.jpg new file mode 100644 index 000000000..d63ee5c3d Binary files /dev/null and b/lgsm/data/bo_header.jpg differ diff --git a/lgsm/data/rust_header.jpg b/lgsm/data/rust_header.jpg new file mode 100644 index 000000000..e4006b070 Binary files /dev/null and b/lgsm/data/rust_header.jpg differ diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index ec5ae600d..687a3f63d 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -68,6 +68,7 @@ ns2c,ns2cserver,NS2: Combat onset,onsetserver,Onset opfor,opforserver,Opposing Force pc,pcserver,Project Cars +pmc,pmcserver,PaperMC pstbs,pstbsserver,Post Scriptum: The Bloody Seventh pvkii,pvkiiserver,Pirates Vikings & Knights II pvr,pvrserver,Pavlov VR @@ -110,6 +111,7 @@ vs,vsserver,Vampire Slayer vints,vintsserver,Vintage Story wet,wetserver,Wolfenstein: Enemy Territory wf,wfserver,Warfork +wmc,wmcserver,WaterfallMC wurm,wurmserver,Wurm Unlimited zmr,zmrserver,Zombie Master: Reborn zps,zpsserver,Zombie Panic! Source diff --git a/lgsm/functions/alert.sh b/lgsm/functions/alert.sh index 916f80e67..5fd999728 100755 --- a/lgsm/functions/alert.sh +++ b/lgsm/functions/alert.sh @@ -7,6 +7,8 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +# Generates alert log of the details at the time of the alert. +# Used with email alerts. fn_alert_log(){ info_distro.sh info_config.sh diff --git a/lgsm/functions/alert_discord.sh b/lgsm/functions/alert_discord.sh index b8467eecc..1d047b60b 100755 --- a/lgsm/functions/alert_discord.sh +++ b/lgsm/functions/alert_discord.sh @@ -15,13 +15,13 @@ fi json=$(cat <&1 | grep "version") if [ "${javaversion}" ]; then # Added for users using Oracle JRE to bypass the check. @@ -441,18 +441,6 @@ fn_deps_build_debian(){ # Sven Co-op elif [ "${shortname}" == "sven" ]; then array_deps_required+=( libssl1.1:i386 zlib1g:i386 ) - # Unreal Engine - elif [ "${executable}" == "./ucc-bin" ]; then - # UT2K4 - if [ -f "${executabledir}/ut2004-bin" ]; then - array_deps_required+=( libsdl1.2debian libstdc++5:i386 ) - # UT99 - else - array_deps_required+=( libsdl1.2debian ) - fi - # Unreal Tournament - elif [ "${shortname}" == "ut" ]; then - array_deps_required+=( unzip ) # Vintage Story elif [ "${shortname}" == "vints" ]; then array_deps_required+=( mono-complete ) @@ -466,6 +454,15 @@ fn_deps_build_debian(){ elif [ "${shortname}" == "pvr" ]; then array_deps_required+=( libc++1 ) fi + + # check if system is a lxc container and the hostname dependency. + if command -v systemd-detect-virt &> /dev/null; then + systemd_virt=$(systemd-detect-virt) + if [ "${systemd_virt}" == "lxc" ]||[ "${systemd_virt}" == "lxc-libvirt" ]; then + array_deps_required+=( hostname ) + fi + fi + fn_deps_email fn_check_loop } @@ -533,7 +530,7 @@ fn_deps_build_redhat(){ elif [ "${shortname}" == "hw" ]||[ "${shortname}" == "rust" ]; then array_deps_required+=( zlib-devel ) # Minecraft, Rising World, Wurm - elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "rw" ]; then + elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]||[ "${shortname}" == "rw" ]; then javaversion=$(java -version 2>&1 | grep "version") if [ "${javaversion}" ]; then # Added for users using Oracle JRE to bypass the check. @@ -556,18 +553,6 @@ fn_deps_build_redhat(){ # Sven Co-op elif [ "${shortname}" == "sven" ]; then : # not compatible - # Unreal Engine - elif [ "${executable}" == "./ucc-bin" ]; then - # UT2K4 - if [ -f "${executabledir}/ut2004-bin" ]; then - array_deps_required+=( compat-libstdc++-33.i686 SDL.i686 bzip2 ) - # UT99 - else - array_deps_required+=( SDL.i686 bzip2 ) - fi - # Unreal Tournament - elif [ "${shortname}" == "ut" ]; then - array_deps_required+=( unzip ) # Vintage Story elif [ "${shortname}" == "vints" ]; then array_deps_required+=( mono-complete ) @@ -581,6 +566,15 @@ fn_deps_build_redhat(){ elif [ "${shortname}" == "pvr" ]; then array_deps_required+=( libcxx ) fi + + # check if system is a lxc container and the hostname dependency. + if command -v systemd-detect-virt &> /dev/null; then + systemd_virt=$(systemd-detect-virt) + if [ "${systemd_virt}" == "lxc" ]||[ "${systemd_virt}" == "lxc-libvirt" ]; then + array_deps_required+=( hostname ) + fi + fi + fn_deps_email fn_check_loop } diff --git a/lgsm/functions/check_system_requirements.sh b/lgsm/functions/check_system_requirements.sh index 2922361f0..cc72288fb 100755 --- a/lgsm/functions/check_system_requirements.sh +++ b/lgsm/functions/check_system_requirements.sh @@ -26,7 +26,7 @@ elif [ "${shortname}" == "arma3" ]; then elif [ "${shortname}" == "rust" ]; then ramrequirementmb="4000" ramrequirementgb="4" -elif [ "${shortname}" == "mc" ]; then +elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then ramrequirementmb="1000" ramrequirementgb="1" elif [ "${shortname}" == "pstbs" ]; then diff --git a/lgsm/functions/command_debug.sh b/lgsm/functions/command_debug.sh index 07871ce00..aac203ac9 100755 --- a/lgsm/functions/command_debug.sh +++ b/lgsm/functions/command_debug.sh @@ -29,7 +29,6 @@ fix.sh info_distro.sh info_config.sh # NOTE: Check if works with server without parms. Could be intergrated in to info_parms.sh. -fn_parms fn_print_header { echo -e "${lightblue}Distro:\t\t${default}${distroname}" @@ -68,13 +67,15 @@ fi if [ "${serverpassword}" ]; then echo -e "${lightblue}Server password:\t${default}${serverpassword}" fi + +fn_reload_startparameters echo -e "${lightblue}Start parameters:${default}" if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then - echo -e "${executable} ${parms} -debug" + echo -e "${executable} ${startparameters} -debug" elif [ "${engine}" == "quake" ]; then - echo -e "${executable} ${parms} -condebug" + echo -e "${executable} ${startparameters} -condebug" else - echo -e "${preexecutable} ${executable} ${parms}" + echo -e "${preexecutable} ${executable} ${startparameters}" fi echo -e "" echo -e "Use for identifying server issues only!" @@ -104,19 +105,19 @@ fn_script_log_info "Lockfile generated" fn_script_log_info "${lockdir}/${selfname}.lock" cd "${executabledir}" || exit -# Note: do not add double quotes to ${executable} ${parms}. +# Note: do not add double quotes to ${executable} ${startparameters}. if [ "${engine}" == "source" ]||[ "${engine}" == "goldsrc" ]; then - ${executable} ${parms} -debug + ${executable} ${startparameters} -debug elif [ "${shortname}" == "arma3" ]; then # Arma3 requires semicolons in the module list, which need to # be escaped for regular (tmux) loading, but need to be # stripped when loading straight from the console. ${executable} ${parms//\\;/;} elif [ "${engine}" == "quake" ]; then - ${executable} ${parms} -condebug + ${executable} ${startparameters} -condebug else # shellcheck disable=SC2086 - ${preexecutable} ${executable} ${parms} + ${preexecutable} ${executable} ${startparameters} fi fn_lockfile_trap diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 8f2a03a98..14765ca99 100755 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -32,7 +32,6 @@ fn_info_message_script fn_info_message_backup # Some game servers do not have parms. if [ "${shortname}" != "ts3" ]&&[ "${shortname}" != "jc2" ]&&[ "${shortname}" != "dst" ]&&[ "${shortname}" != "pz" ]&&[ "${engine}" != "renderware" ]; then - fn_parms fn_info_message_commandlineparms fi fn_info_message_ports diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index 2474ffd47..d6ab960bd 100755 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -178,7 +178,7 @@ fn_fastdl_preview(){ elif [ "${directory}" == "materials" ]; then local allowed_extentions_array=( "*.vtf" "*.vmt" "*.vbf" "*.png" "*.svg" ) elif [ "${directory}" == "models" ]; then - local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" ) + local allowed_extentions_array=( "*.vtx" "*.vvd" "*.mdl" "*.phy" "*.jpg" "*.png" "*.vmt" "*.vtf" ) elif [ "${directory}" == "particles" ]; then local allowed_extentions_array=( "*.pcf" ) elif [ "${directory}" == "sound" ]; then diff --git a/lgsm/functions/command_postdetails.sh b/lgsm/functions/command_postdetails.sh index 811938380..fa2907b1e 100755 --- a/lgsm/functions/command_postdetails.sh +++ b/lgsm/functions/command_postdetails.sh @@ -52,7 +52,6 @@ else fn_info_message_backup # Some game servers do not have parms. if [ "${shortname}" != "jc2" ]&&[ "${shortname}" != "jc3" ]&&[ "${shortname}" != "dst" ]&&[ "${shortname}" != "pz" ]&&[ "${engine}" != "renderware" ]; then - fn_parms fn_info_message_commandlineparms fi fn_info_message_ports diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh index cc79613fb..caa933320 100755 --- a/lgsm/functions/command_start.sh +++ b/lgsm/functions/command_start.sh @@ -41,9 +41,7 @@ fn_start_jk2(){ fn_start_tmux(){ if [ "${parmsbypass}" ]; then - parms="" - else - fn_parms + startparameters="" fi # check for tmux size variables. if [[ "${servercfgtmuxwidth}" =~ ^[0-9]+$ ]]; then @@ -73,8 +71,9 @@ fn_start_tmux(){ date '+%s' > "${lockdir}/${selfname}.lock" echo "${version}" >> "${lockdir}/${selfname}.lock" echo "${port}" >> "${lockdir}/${selfname}.lock" + fn_reload_startparameters cd "${executabledir}" || exit - tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}" "${preexecutable} ${executable} ${parms}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp" + tmux new-session -d -x "${sessionwidth}" -y "${sessionheight}" -s "${sessionname}" "${preexecutable} ${executable} ${startparameters}" 2> "${lgsmlogdir}/.${selfname}-tmux-error.tmp" # Create logfile. touch "${consolelog}" @@ -82,26 +81,22 @@ fn_start_tmux(){ # Create last start lock file date +%s > "${lockdir}/${selfname}-laststart.lock" - # Get tmux version. - tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p') - # Tmux compiled from source will return "master", therefore ignore it. - if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p')" == "master" ]; then - fn_script_log "Tmux version: master (user compiled)" - echo -e "Tmux version: master (user compiled)" >> "${consolelog}" + # tmux compiled from source will return "master", therefore ignore it. + if [ "${tmuxv}" == "master" ]; then + fn_script_log "tmux version: master (user compiled)" + echo -e "tmux version: master (user compiled)" >> "${consolelog}" if [ "${consolelogging}" == "on" ]||[ -z "${consolelogging}" ]; then tmux pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'" fi - elif [ "${tmuxversion}" ]; then - # Get the digit version of tmux. - tmuxversion=$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]') + elif [ -n "${tmuxv}" ]; then # tmux pipe-pane not supported in tmux versions < 1.6. - if [ "${tmuxversion}" -lt "16" ]; then - echo -e "Console logging disabled: Tmux => 1.6 required + if [ "${tmuxvdigit}" -lt "16" ]; then + echo -e "Console logging disabled: tmux => 1.6 required https://linuxgsm.com/tmux-upgrade Currently installed: $(tmux -V)" > "${consolelog}" # Console logging disabled: Bug in tmux 1.8 breaks logging. - elif [ "${tmuxversion}" -eq "18" ]; then + elif [ "${tmuxvdigit}" -eq "18" ]; then echo -e "Console logging disabled: Bug in tmux 1.8 breaks logging https://linuxgsm.com/tmux-upgrade Currently installed: $(tmux -V)" > "${consolelog}" @@ -127,12 +122,12 @@ fn_start_tmux(){ fn_print_fail_nl "Unable to start ${servername}" fn_script_log_fatal "Unable to start ${servername}" if [ -s "${lgsmlogdir}/.${selfname}-tmux-error.tmp" ]; then - fn_print_fail_nl "Unable to start ${servername}: Tmux error:" - fn_script_log_fatal "Unable to start ${servername}: Tmux error:" + fn_print_fail_nl "Unable to start ${servername}: tmux error:" + fn_script_log_fatal "Unable to start ${servername}: tmux error:" echo -e "" echo -e "Command" echo -e "=================================" - echo -e "tmux new-session -d -s \"${sessionname}\" \"${preexecutable} ${executable} ${parms}\"" | tee -a "${lgsmlog}" + echo -e "tmux new-session -d -s \"${sessionname}\" \"${preexecutable} ${executable} ${startparameters}\"" | tee -a "${lgsmlog}" echo -e "" echo -e "Error" echo -e "=================================" @@ -171,7 +166,7 @@ fn_start_tmux(){ fn_print_ok "${servername}" fn_script_log_pass "Started ${servername}" fi - rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp" + rm "${lgsmlogdir:?}/.${selfname}-tmux-error.tmp" 2>/dev/null echo -en "\n" } diff --git a/lgsm/functions/command_update.sh b/lgsm/functions/command_update.sh index fdaf9f5a0..828c8c38d 100755 --- a/lgsm/functions/command_update.sh +++ b/lgsm/functions/command_update.sh @@ -21,6 +21,8 @@ elif [ "${shortname}" == "mc" ]; then update_minecraft.sh elif [ "${shortname}" == "mcb" ]; then update_minecraft_bedrock.sh +elif [ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then + update_papermc.sh elif [ "${shortname}" == "mumble" ]; then update_mumble.sh elif [ "${shortname}" == "fctr" ]; then diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh index 63cb830fb..d2d05defc 100755 --- a/lgsm/functions/command_wipe.sh +++ b/lgsm/functions/command_wipe.sh @@ -12,9 +12,9 @@ fn_firstcommand_set # Provides an exit code upon error. fn_wipe_exit_code(){ - ((exitcode=$?)) + exitcode=$? if [ "${exitcode}" != 0 ]; then - fn_script_log_fatal "${currentaction}" + fn_print_fail_eol_nl core_exit.sh else fn_print_ok_eol_nl @@ -22,209 +22,160 @@ fn_wipe_exit_code(){ } # Removes files to wipe server. -fn_wipe_server_files(){ - fn_print_start_nl "Wiping server" - fn_script_log_info "Wiping server" - # Wipe procedural map. - if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then - echo -en "removing procedural map proceduralmap.*.map file(s)..." - fn_sleep_time - fn_script_log_info "Removing procedural map file(s): ${serveridentitydir}/proceduralmap.*.map" - find "${serveridentitydir:?}" -type f -name "proceduralmap.*.map" -delete | tee -a "${lgsmlog}" - fn_wipe_exit_code - fn_sleep_time - else - echo -e "no procedural map file to remove" - fn_sleep_time - fn_script_log_pass "No procedural map file to remove" - fi - # Wipe Barren map. - if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then - echo -en "removing barren map barren*.map file(s)..." - fn_sleep_time - fn_script_log_info "Removing map file(s): ${serveridentitydir}/barren*.map" - find "${serveridentitydir:?}" -type f -name "barren*.map" -delete | tee -a "${lgsmlog}" - fn_wipe_exit_code - fn_sleep_time - else - echo -e "no barren map file to remove" - fn_sleep_time - fn_script_log_pass "No barren map file to remove" - fi - # Wipe custom map. - if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]; then - echo -en "removing custom map file(s)..." - fn_sleep_time - fn_script_log_info "Removing map file(s): ${serveridentitydir}/*.map" - find "${serveridentitydir:?}" -type f -name "*.map" -delete | tee -a "${lgsmlog}" - fn_wipe_exit_code - fn_sleep_time - else - echo -e "no map file to remove" - fn_sleep_time - fn_script_log_pass "No map file to remove" - fi - # Wipe custom map save. - if [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]; then - echo -en "removing map save *.sav* file(s)..." - fn_sleep_time - fn_script_log_info "Removing map save(s): ${serveridentitydir}/*.sav*" - find "${serveridentitydir:?}" -type f -name "*.sav*" -delete | tee -a "${lgsmlog}" - fn_wipe_exit_code - fn_sleep_time - else - echo -e "no map save to remove" - fn_sleep_time - fn_script_log_pass "No map save to remove." - fi - # Wipe user dir, might be a legacy thing, maybe to be removed. - if [ -d "${serveridentitydir}/user" ]; then - echo -en "removing user directory..." - fn_sleep_time - fn_script_log_info "removing user directory: ${serveridentitydir}/user" - rm -rf "${serveridentitydir:?}/user" - fn_wipe_exit_code - fn_sleep_time - # We do not print additional information if there is nothing to remove since this might be obsolete. - fi - # Wipe storage dir, might be a legacy thing, maybe to be removed. - if [ -d "${serveridentitydir}/storage" ]; then - echo -en "removing storage directory..." - fn_sleep_time - fn_script_log_info "removing storage directory: ${serveridentitydir}/storage" - rm -rf "${serveridentitydir:?}/storage" - fn_wipe_exit_code - fn_sleep_time - # We do not print additional information if there is nothing to remove since this might be obsolete. - fi - # Wipe sv.files. - if [ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then - echo -en "removing server misc srv.files*.db file(s)..." - fn_sleep_time - fn_script_log_info "Removing server misc files: ${serveridentitydir}/sv.files.*.db" - find "${serveridentitydir:?}" -type f -name "sv.files.*.db" -delete | tee -a "${lgsmlog}" - fn_wipe_exit_code - fn_sleep_time - # No further information if not found because it should I could not get this file showing up. - fi - # Wipe player death files. - if [ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then - echo -en "removing player deaths player.deaths.*.db file(s)..." - fn_sleep_time - fn_script_log_info "Removing player death files: ${serveridentitydir}/player.deaths.*.db" - find "${serveridentitydir:?}" -type f -name "player.deaths.*.db" -delete | tee -a "${lgsmlog}" - fn_wipe_exit_code - fn_sleep_time - else - echo -e "no player death to remove" - fn_sleep_time - fn_script_log_pass "No player death to remove" - fi - # Wipe player states files - if [ -n "$(find "${serveridentitydir}" -type f -name "player.states.*.db")" ]; then - echo -en "removing player states player.states.*.db file(s)..." - fn_sleep_time - fn_script_log_info "Removing player states: ${serveridentitydir}/player.states.*.db" - find "${serveridentitydir:?}" -type f -name "player.states.*.db" -delete | tee -a "${lgsmlog}" - fn_wipe_exit_code - fn_sleep_time - else - echo -e "no player states to remove" - fn_sleep_time - fn_script_log_pass "No player states to remove" - fi - # Wipe blueprints only if full-wipe command was used. - if [ "${fullwipe}" == "1" ]; then - if [ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then - echo -en "removing blueprints player.blueprints.*.db file(s)..." +fn_wipe_files(){ + fn_print_start_nl "${wipetype}" + fn_script_log_info "${wipetype}" + + # Remove Map files + if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then + if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]; then + echo -en "removing .map file(s)..." + fn_script_log_info "removing *.map file(s)" fn_sleep_time - fn_script_log_info "Removing blueprint file(s): ${serveridentitydir}/player.blueprints.*.db" - find "${serveridentitydir:?}" -type f -name "player.blueprints.*.db" -delete | tee -a "${lgsmlog}" + find "${serveridentitydir:?}" -type f -name "*.map" -printf "%f\n" >> "${lgsmlog}" + find "${serveridentitydir:?}" -type f -name "*.map" -delete | tee -a "${lgsmlog}" fn_wipe_exit_code + else + echo -e "no .map file(s) to remove" + fn_sleep_time + fn_script_log_pass "no .map file(s) to remove" + fi + fi + # Remove Save files. + if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then + if [ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]; then + echo -en "removing .sav file(s)..." + fn_script_log_info "removing .sav file(s)" fn_sleep_time + find "${serveridentitydir:?}" -type f -name "*.sav*" -printf "%f\n" >> "${lgsmlog}" + find "${serveridentitydir:?}" -type f -name "*.sav*" -delete + fn_wipe_exit_code else - echo -e "no blueprint file to remove" + echo -e "no .sav file(s) to remove" + fn_script_log_pass "no .sav file(s) to remove" fn_sleep_time - fn_script_log_pass "No blueprint file to remove" fi - elif [ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then - echo -e "keeping blueprints" - fn_sleep_time - fn_script_log_info "Keeping blueprints" - else - echo -e "no blueprints found" - fn_sleep_time - fn_script_log_pass "No blueprints found" fi - # Wipe some logs that might be there. - if [ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then - echo -en "removing log files..." - fn_sleep_time - fn_script_log_info "Removing log files: ${serveridentitydir}/Log.*.txt" - find "${serveridentitydir:?}" -type f -name "Log.*.txt" -delete - fn_wipe_exit_code - fn_sleep_time - # We do not print additional information if there are no logs to remove. + # Remove db files for full wipe. + # Excluding player.tokens.db for Rust+. + if [ -n "${serverwipe}" ]; then + if [ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then + echo -en "removing .db file(s)..." + fn_script_log_info "removing .db file(s)" + fn_sleep_time + find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -printf "%f\n" >> "${lgsmlog}" + find "${serveridentitydir:?}" -type f ! -name 'player.tokens.db' -name "*.db" -delete + fn_wipe_exit_code + else + echo -e "no .db file(s) to remove" + fn_sleep_time + fn_script_log_pass "no .db file(s) to remove" + fi fi } -fn_stop_warning(){ - fn_print_warn "this game server will be stopped during wipe" - fn_script_log_warn "this game server will be stopped during wipe" +fn_map_wipe_warning(){ + fn_print_warn "Map wipe will reset the map data and keep blueprint data" + fn_script_log_warn "Map wipe will reset the map data and keep blueprint data" totalseconds=3 for seconds in {3..1}; do - fn_print_warn "this game server will be stopped during wipe: ${totalseconds}" + fn_print_warn "Map wipe will reset the map data and keep blueprint data: ${totalseconds}" totalseconds=$((totalseconds - 1)) sleep 1 if [ "${seconds}" == "0" ]; then break fi done - fn_print_warn_nl "this game server will be stopped during wipe" + fn_print_warn_nl "Map wipe will reset the map data and keep blueprint data" } -fn_wipe_warning(){ - fn_print_warn "wipe is about to start" - fn_script_log_warn "wipe is about to start" +fn_full_wipe_warning(){ + fn_print_warn "Server wipe will reset the map data and remove blueprint data" + fn_script_log_warn "Server wipe will reset the map data and remove blueprint data" totalseconds=3 for seconds in {3..1}; do - fn_print_warn "wipe is about to start: ${totalseconds}" + fn_print_warn "Server wipe will reset the map data and remove blueprint data: ${totalseconds}" totalseconds=$((totalseconds - 1)) sleep 1 if [ "${seconds}" == "0" ]; then break fi done - fn_print_warn "wipe is about to start" + fn_print_warn_nl "Server wipe will reset the map data and remove blueprint data" } -# Will change the seed everytime the wipe command is run if the seed in config is not set. +# Will change the seed if the seed is not defined by the user. fn_wipe_random_seed(){ - shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt" + if [ -f "${datadir}/${selfname}-seed.txt" ]&&[ -n "${randomseed}" ]; then + shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt" + seed=$(cat "${datadir}/${selfname}-seed.txt") + randomseed=1 + echo -en "generating new random seed (${cyan}${seed}${default})..." + fn_script_log_pass "generating new random seed (${cyan}${seed}${default})" + fn_sleep_time + fn_print_ok_eol_nl + fi +} + +# A summary of what wipe is going to do. +fn_wipe_details(){ + fn_print_information_nl "Wipe does not remove Rust+ data." + echo -en "* Wipe map data: " + if [ -n "${serverwipe}" ]||[ -n "${mapwipe}" ]; then + fn_print_yes_eol_nl + else + fn_print_no_eol_nl + fi + + echo -en "* Wipe blueprint data: " + if [ -n "${serverwipe}" ]; then + fn_print_yes_eol_nl + else + fn_print_no_eol_nl + fi + + echo -en "* Change Procedural Map seed: " + if [ -n "${randomseed}" ]; then + fn_print_yes_eol_nl + else + fn_print_no_eol_nl + fi } fn_print_dots "" check.sh +fix_rust.sh # Check if there is something to wipe. -if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then - fn_wipe_warning +if [ -n "$(find "${serveridentitydir}" -type f -name "*.map")" ]||[ -n "$(find "${serveridentitydir}" -type f -name "*.sav*")" ]&&[ -n "$(find "${serveridentitydir}" -type f ! -name 'player.tokens.db' -name "*.db")" ]; then + if [ -n "${serverwipe}" ]; then + wipetype="Full wipe" + fn_full_wipe_warning + fn_wipe_details + elif [ -n "${mapwipe}" ]; then + wipetype="Map wipe" + fn_map_wipe_warning + fn_wipe_details + fi check_status.sh if [ "${status}" != "0" ]; then - fn_stop_warning + fn_print_restart_warning exitbypass=1 command_stop.sh fn_firstcommand_reset - fn_wipe_server_files + fn_wipe_files + fn_wipe_random_seed + fn_print_complete_nl "${wipetype}" + fn_script_log_pass "${wipetype}" exitbypass=1 command_start.sh fn_firstcommand_reset else - fn_wipe_server_files + fn_wipe_files + fn_wipe_random_seed + fn_print_complete_nl "${wipetype}" + fn_script_log_pass "${wipetype}" fi - fn_print_complete_nl "Wiping ${selfname}" - fn_script_log_pass "Wiping ${selfname}" - fn_wipe_random_seed else fn_print_ok_nl "Wipe not required" fn_script_log_pass "Wipe not required" diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index be613a45a..ec1a98531 100755 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -8,7 +8,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v21.1.3" +modulesversion="v21.2.3" # Core @@ -39,10 +39,6 @@ else fi } -fn_parms(){ -parms="${startparameters}" -} - core_exit.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function @@ -644,6 +640,11 @@ functionfile="${FUNCNAME[0]}" fn_fetch_function } +update_papermc.sh(){ +functionfile="${FUNCNAME[0]}" +fn_fetch_function +} + update_mumble.sh(){ functionfile="${FUNCNAME[0]}" fn_fetch_function diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index 904bad37d..ea3c84f6d 100755 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -40,8 +40,8 @@ cmd_mods_update=( "mu;mods-update" "command_mods_update.sh" "Update installed mo # Server specific. cmd_change_password=( "pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password." ) cmd_install_default_resources=( "ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources." ) -cmd_wipe=( "w;wipe;wi" "command_wipe.sh" "Map assets are wiped and blueprints are kept." ) -cmd_full_wipe=( "fw;full-wipe;wa;wipeall" "fullwipe=1; command_wipe.sh" "Map assets and blueprints are wiped." ) +cmd_fullwipe=( "fw;full-wipe;wa;wipeall" "serverwipe=1; command_wipe.sh" "Reset the map and remove blueprint data." ) +cmd_mapwipe=( "mw;map-wipe;w;wipe;wi" "mapwipe=1; command_wipe.sh" "Reset the map and keep blueprint data." ) cmd_map_compressor_u99=( "mc;map-compressor" "compress_ut99_maps.sh" "Compresses all ${gamename} server maps." ) cmd_map_compressor_u2=( "mc;map-compressor" "compress_unreal2_maps.sh" "Compresses all ${gamename} server maps." ) cmd_install_cdkey=( "cd;server-cd-key" "install_ut2k4_key.sh" "Add your server cd key." ) @@ -105,7 +105,7 @@ fi # Unreal exclusive. if [ "${shortname}" == "rust" ]; then - currentopt+=( "${cmd_wipe[@]}" "${cmd_full_wipe[@]}" ) + currentopt+=( "${cmd_fullwipe[@]}" "${cmd_mapwipe[@]}" ) fi if [ "${engine}" == "unreal2" ]; then if [ "${shortname}" == "ut2k4" ]; then diff --git a/lgsm/functions/core_legacy.sh b/lgsm/functions/core_legacy.sh index 2ea30f5a6..811acfbba 100755 --- a/lgsm/functions/core_legacy.sh +++ b/lgsm/functions/core_legacy.sh @@ -77,3 +77,8 @@ if [ -z "${wsstartmap}" ]; then wscollectionid="${ws_start_map}" fi fi + +fn_parms(){ + fn_reload_startparameters + parms="${startparameters}" +} diff --git a/lgsm/functions/core_messages.sh b/lgsm/functions/core_messages.sh index a56ade188..463f833c2 100755 --- a/lgsm/functions/core_messages.sh +++ b/lgsm/functions/core_messages.sh @@ -116,7 +116,7 @@ fn_script_log_info(){ fi } -## Feb 28 14:56:58 ut99-server: Monitor: INFO: +## Feb 28 14:56:58 ut99-server: Monitor: UPDATE: fn_script_log_update(){ if [ -d "${lgsmlogdir}" ]; then if [ -n "${commandname}" ]; then @@ -375,6 +375,28 @@ fn_prompt_message(){ # On-Screen End of Line ################################## +# YES +fn_print_yes_eol(){ + echo -en "${cyan}YES${default}" + fn_sleep_time +} + +fn_print_yes_eol_nl(){ + echo -e "${cyan}YES${default}" + fn_sleep_time +} + +# NO +fn_print_no_eol(){ + echo -en "${red}NO${default}" + fn_sleep_time +} + +fn_print_no_eol_nl(){ + echo -e "${red}NO${default}" + fn_sleep_time +} + # OK fn_print_ok_eol(){ echo -en "${green}OK${default}" diff --git a/lgsm/functions/fix.sh b/lgsm/functions/fix.sh index 654ddd391..1b5e63db6 100755 --- a/lgsm/functions/fix.sh +++ b/lgsm/functions/fix.sh @@ -96,7 +96,7 @@ fi if [ "${commandname}" == "INSTALL" ]; then if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "samp" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then echo -e "" - echo -e "Applying Post-Install Fixes" + echo -e "${lightyellow}Applying Post-Install Fixes}${default}" echo -e "=================================" fn_sleep_time postinstall=1 diff --git a/lgsm/functions/fix_av.sh b/lgsm/functions/fix_av.sh index 6aed64f5e..f34a01c37 100755 --- a/lgsm/functions/fix_av.sh +++ b/lgsm/functions/fix_av.sh @@ -10,14 +10,10 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64" if [ "${postinstall}" == "1" ]; then - fn_parms(){ - parms="--datapath ${avdatapath} --galaxy-name ${selfname} --init-folders-only" - } - + startparameters="--datapath ${avdatapath} --galaxy-name ${selfname} --init-folders-only" fn_print_information "starting ${gamename} server to generate configs." fn_sleep_time # go to the executeable dir and start the init of the server cd "${systemdir}" || return 2 - fn_parms - "${executabledir}/${executable}" ${parms} + "${executabledir}/${executable}" ${startparameters} fi diff --git a/lgsm/functions/fix_kf2.sh b/lgsm/functions/fix_kf2.sh index d9f8c82b4..b680a9937 100755 --- a/lgsm/functions/fix_kf2.sh +++ b/lgsm/functions/fix_kf2.sh @@ -7,9 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_parms(){ -parms="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\"" -} +startparameters="\"${defaultmap}?Game=KFGameContent.KFGameInfo_VersusSurvival\"" fn_print_information "starting ${gamename} server to generate configs." fn_sleep_time diff --git a/lgsm/functions/fix_rust.sh b/lgsm/functions/fix_rust.sh index 1e62898df..4488377a3 100755 --- a/lgsm/functions/fix_rust.sh +++ b/lgsm/functions/fix_rust.sh @@ -9,3 +9,13 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" # Fixes: [Raknet] Server Shutting Down (Shutting Down). export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/RustDedicated_Data/Plugins/x86_64" + +# Part of random seed feature. +# If seed is not defined by user generate a seed file. +if [ -z "${seed}" ]; then + if [ ! -f "${datadir}/${selfname}-seed.txt" ]; then + shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt" + fi + seed="$(cat "${datadir}/${selfname}-seed.txt")" + randomseed=1 +fi diff --git a/lgsm/functions/fix_ts3.sh b/lgsm/functions/fix_ts3.sh index 223c90aea..b1ed7d84b 100755 --- a/lgsm/functions/fix_ts3.sh +++ b/lgsm/functions/fix_ts3.sh @@ -14,3 +14,20 @@ if [ ! -f "${serverfiles}/libmariadb.so.2" ]; then cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}/libmariadb.so.2" fn_fix_msg_end fi + +# Fixes: failed to register local accounting service: No such file or directory. +accountingfile="/dev/shm/7gbhujb54g8z9hu43jre8" +if [ -f "${accountingfile}" ]; then + # Check permissions for the file if the current user owns it, if not exit. + if [ "$( stat -c %U ${accountingfile})" == "$(whoami)" ]; then + fixname="Delete file ${accountingfile}" + fn_fix_msg_start + rm -f "${accountingfile}" + fn_fix_msg_end + # file is not owned by the current user and needs to be deleted manually. + else + fn_print_error_nl "File ${accountingfile} is not owned by $(whoami) and needs to be deleted manually" + fn_script_log_fatal "File ${accountingfile} is not owned by $(whoami) and needs to be deleted manually" + core_exit.sh + fi +fi diff --git a/lgsm/functions/fix_ut3.sh b/lgsm/functions/fix_ut3.sh index d3b6f824b..6bd26a53a 100755 --- a/lgsm/functions/fix_ut3.sh +++ b/lgsm/functions/fix_ut3.sh @@ -7,9 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -fn_parms(){ -parms="server VCTF-Suspense?Game=UTGameContent.UTVehicleCTFGame_Content?bIsDedicated=true?bIsLanMatch=false?bUsesStats=false?bShouldAdvertise=false?PureServer=1?bAllowJoinInProgress=true?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}" -} +startparameters="server VCTF-Suspense?Game=UTGameContent.UTVehicleCTFGame_Content?bIsDedicated=true?bIsLanMatch=false?bUsesStats=false?bShouldAdvertise=false?PureServer=1?bAllowJoinInProgress=true?ConfigSubDir=${selfname} -port=${port} -queryport=${queryport} -multihome=${ip} -nohomedir -unattended -log=${gamelog}" fn_print_information "starting ${gamename} server to generate configs." fn_sleep_time diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index d8bbb081a..26e2c7b29 100755 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -1567,6 +1567,28 @@ fn_info_config_scpsl(){ fi } +fn_info_config_waterfall(){ + if [ -f "${servercfgfullpath}" ]; then + servername=$(sed -e '/^listeners:/,/^[a-z]/!d' "${servercfgfullpath}" | sed -nr 's/^[ ]+motd: (.*)$/\1/p' | tr -d "'" | sed 's/&1//') + queryport=$(sed -nr 's/^[ -]+query_port: ([0-9]+)/\1/p' "${servercfgfullpath}") + queryenabled=$(sed -nr 's/^[ ]+query_enabled: (.*)$/\1/p' "${servercfgfullpath}") + port=$(sed -nr 's/^[ ]+host: [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:([0-9]+)/\1/p' "${servercfgfullpath}") + # the normal max_players does only show in on the client side and has no effect how many players can connect + maxplayers=$(sed -nr 's/^player_limit: ([-]*[0-9])/\1/p' "${servercfgfullpath}") + configip=$(sed -nr 's/^[ ]+host: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+):[0-9]+/\1/p' "${servercfgfullpath}") + + if [ "${maxplayers}" == "-1" ]||[ "${maxplayers}" == "0" ]; then + maxplayers="UNLIMITED" + fi + else + servername="${unavailable}" + maxplayers="${zero}" + port="${zero}" + queryport="${zero}" + queryenabled="${unavailable}" + fi +} + if [ "${shortname}" == "ac" ]; then fn_info_config_assettocorsa elif [ "${shortname}" == "ark" ]; then @@ -1621,7 +1643,7 @@ elif [ "${shortname}" == "ql" ]; then fn_info_config_quakelive elif [ "${shortname}" == "jk2" ]; then fn_info_config_jk2 -elif [ "${shortname}" == "mc" ]; then +elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then fn_info_config_minecraft elif [ "${shortname}" == "mcb" ]; then fn_info_config_minecraft_bedrock @@ -1693,4 +1715,6 @@ elif [ "${shortname}" == "pvr" ];then fn_info_config_pavlovvr elif [ "${shortname}" == "vints" ]; then fn_info_config_vintagestory +elif [ "${shortname}" == "wmc" ]; then + fn_info_config_waterfall fi diff --git a/lgsm/functions/info_distro.sh b/lgsm/functions/info_distro.sh index 3b199b4f0..283d8ed39 100755 --- a/lgsm/functions/info_distro.sh +++ b/lgsm/functions/info_distro.sh @@ -73,8 +73,10 @@ glibcversion=$(ldd --version | sed -n '1s/.* //p') # e.g: tmux 1.6 if [ ! "$(command -V tmux 2>/dev/null)" ]; then tmuxv="${red}NOT INSTALLED!${default}" + tmuxvdigit="0" else - if [ "$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" -lt "16" ]; then + tmuxvdigit="$(tmux -V | sed "s/tmux //" | sed -n '1 p' | tr -cd '[:digit:]')" + if [ "${tmuxvdigit}" -lt "16" ]; then tmuxv="$(tmux -V) (>= 1.6 required for console log)" else tmuxv=$(tmux -V) @@ -212,7 +214,7 @@ if [ -d "${backupdir}" ]; then # number of backups. backupcount=$(find "${backupdir}"/*.tar.gz | wc -l) # most recent backup. - lastbackup=$(find "${backupdir}"/*.tar.gz | head -1) + lastbackup=$(ls -1t "${backupdir}"/*.tar.gz | head -1) # date of most recent backup. lastbackupdate=$(date -r "${lastbackup}") # no of days since last backup. diff --git a/lgsm/functions/info_messages.sh b/lgsm/functions/info_messages.sh index 1248d52cc..979f0af5b 100755 --- a/lgsm/functions/info_messages.sh +++ b/lgsm/functions/info_messages.sh @@ -7,12 +7,57 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -# Standard Details -# This applies to all engines +# Separator is different for details. +fn_messages_separator(){ + if [ "${commandname}" == "DETAILS" ]; then + printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = + else + echo -e "=================================" + fi +} + +# Removes the passwords form all but details. +fn_info_message_password_strip(){ + if [ "${commandname}" != "DETAILS" ]; then + if [ "${serverpassword}" ]; then + serverpassword="********" + fi + + if [ "${rconpassword}" ]; then + rconpassword="********" + fi + + if [ "${adminpassword}" ]; then + adminpassword="********" + fi + + if [ "${statspassword}" ]; then + statspassword="********" + fi + + if [ "${webadminpass}" ]; then + webadminpass="********" + fi + if [ "${telnetpass}" ]; then + telnetpass="********" + fi + + if [ "${wsapikey}" ]; then + wsapikey="********" + fi + + if [ "${gslt}" ]; then + gslt="********" + fi + fi +} + +# Alert Summary +# used with alertlog fn_info_message_head(){ echo -e "" - echo -e "${lightyellow}Summary${default}" + echo -e "${lightyellow}Alert Summary${default}" fn_messages_separator echo -e "Message" echo -e "${alertbody}" @@ -27,28 +72,27 @@ fn_info_message_head(){ echo -e "${HOSTNAME}" echo -e "" echo -e "Server IP" - if [ "${multiple_ip}" == "1" ]; then - echo -e "NOT SET" - else - echo -e "${ip}:${port}" - fi + echo -e "${ip}:${port}" } fn_info_message_distro(){ # # Distro Details - # ===================================== - # Distro: Ubuntu 14.04.4 LTS + # ================================= + # Date: Sun 21 Feb 2021 09:22:53 AM UTC + # Distro: Ubuntu 20.04.2 LTS # Arch: x86_64 - # Kernel: 3.13.0-79-generic - # Hostname: hostname - # tmux: tmux 1.8 - # glibc: 2.19 + # Kernel: 5.4.0-65-generic + # Hostname: server + # Uptime: 16d, 5h, 18m + # tmux: tmux 3.0a + # glibc: 2.31 echo -e "" echo -e "${lightyellow}Distro Details${default}" fn_messages_separator { + echo -e "${lightblue}Date:\t${default}${date}" echo -e "${lightblue}Distro:\t${default}${distroname}" echo -e "${lightblue}Arch:\t${default}${arch}" echo -e "${lightblue}Kernel:\t${default}${kernel}" @@ -62,23 +106,27 @@ fn_info_message_distro(){ fn_info_message_server_resource(){ # # Server Resource - # ========================================================================================================================================================================================================================================== + # ================================= # CPU - # Model: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz - # Cores: 4 - # Frequency: 2499.994 MHz - # Avg Load: 0.20, 0.08, 0.01 + # Model: AMD EPYC 7601 32-Core Processor + # Cores: 2 + # Frequency: 2199.994MHz + # Avg Load: 0.01, 0.05, 0.18 # # Memory # Mem: total used free cached available - # Physical: 7.8GB 598MB 7.0GB 4.0GB 7.0GB - # Swap: 512MB 0B 512MB + # Physical: 3.9GB 350MB 3.3GB 3.2GB 3.3GB + # Swap: 512MB 55MB 458MB # # Storage - # Filesystem: /dev/sda - # Total: 157G - # Used: 138G - # Available: 12G + # Filesystem: /dev/sda + # Total: 79G + # Used: 73G + # Available: 1.4G + # + # Network + # IP: 0.0.0.0 + # Internet IP: 176.58.124.96 echo -e "" echo -e "${lightyellow}Server Resource${default}" @@ -122,23 +170,32 @@ fn_info_message_server_resource(){ } fn_info_message_gameserver_resource(){ + # # Game Server Resource Usage - # ========================================================================================================================================================================================================================================== - # CPU Used: 2.5% - # Mem Used: 2.1% 171MB + # ================================= + # CPU Used: 1.1% + # Mem Used: 4.8% 189MB # # Storage - # Total: 21G - # Serverfiles: 20G - # Backups: 20K + # Total: 241M + # Serverfiles: 240M + # Backups: 24K echo -e "" echo -e "${lightyellow}Game Server Resource Usage${default}" fn_messages_separator { - if [ "${status}" != "0" ]; then - echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}" - echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}MB${default}" + if [ "${status}" != "0" ]&&[ -v status ]; then + if [ -n "${cpuused}" ]; then + echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}" + else + echo -e "${lightblue}CPU Used:\t${red}unknown${default}" + fi + if [ -n "${memused}" ]; then + echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}MB${default}" + else + echo -e "${lightblue}Mem Used:\t${default}${pmemused}\t${red}unknown${default}" + fi else echo -e "${lightblue}CPU Used:\t${default}0%${default}" echo -e "${lightblue}Mem Used:\t${default}0%\t0MB${default}" @@ -156,10 +213,12 @@ fn_info_message_gameserver_resource(){ } fn_info_message_gameserver(){ + # # Counter-Strike: Global Offensive Server Details - # ========================================================================================================================================================================================================================================== + # ================================= # Server name: LinuxGSM - # Server IP: 80.70.189.230:27015 + # Server IP: 0.0.0.0:27015 + # Internet IP: 176.48.124.96:34197 # Server password: NOT SET # RCON password: adminF54CC0VR # Players: 0/16 @@ -169,7 +228,7 @@ fn_info_message_gameserver(){ # Game mode: 0 # Tick rate: 64 # Master Server: listed - # Status: ONLINE + # Status: STARTED echo -e "" echo -e "${lightgreen}${gamename} Server Details${default}" @@ -203,13 +262,14 @@ fn_info_message_gameserver(){ echo -e "${lightblue}Beta Password:\t${default}${betapassword}" fi - # Server ip - if [ "${multiple_ip}" == "1" ]; then - echo -e "${lightblue}Server IP:\t${default}NOT SET" - else - echo -e "${lightblue}Server IP:\t${default}${ip}:${port}" + # Server Version + if [ -n "${gdversion}" ]; then + echo -e "${lightblue}Server Version:\t${default}${gdversion}" fi + # Server ip + echo -e "${lightblue}Server IP:\t${default}${ip}:${port}" + # Internet ip if [ -n "${extip}" ]; then if [ "${ip}" != "${extip}" ]; then @@ -292,7 +352,7 @@ fn_info_message_gameserver(){ fi if [ -n "${defaultscenario}" ]; then - # Current scenario + # Current scenario (Insurgency: Sandstorm) if [ -n "${gdgamemode}" ]; then echo -e "${lightblue}Current scenario:\t${default}${gdgamemode}" fi @@ -370,7 +430,22 @@ fn_info_message_gameserver(){ # Save interval (Rust) if [ -n "${saveinterval}" ]; then - echo -e "${lightblue}ASE:\t${default}${saveinterval} s" + echo -e "${lightblue}Save interval:\t${default}${saveinterval}s" + fi + + # Seed (Rust) + if [ -n "${seed}" ]; then + echo -e "${lightblue}Seed:\t${default}${seed}" + fi + + # Salt (Rust) + if [ -n "${salt}" ]; then + echo -e "${lightblue}Salt:\t${default}${salt}" + fi + + # World Size (Rust) + if [ -n "${worldsize}" ]; then + echo -e "${lightblue}World size:\t${default}${worldsize}m" fi # Random map rotation mode (Squad and Post Scriptum) @@ -407,23 +482,22 @@ fn_info_message_gameserver(){ fi fi - # Online status + # Game server status if [ "${status}" == "0" ]; then - echo -e "${lightblue}Status:\t${red}OFFLINE${default}" + echo -e "${lightblue}Status:\t${red}STOPPED${default}" else - echo -e "${lightblue}Status:\t${green}ONLINE${default}" + echo -e "${lightblue}Status:\t${green}STARTED${default}" fi } | column -s $'\t' -t echo -e "" } fn_info_message_script(){ - # # csgoserver Script Details - #========================================================================================================================================================================================================================================== - # Script name: csgoserver - # LinuxGSM version: v19.9.0 - # glibc required: 2.15 + # ================================= + # Script name: csgoserver + # LinuxGSM version: v21.1.3 + # glibc required: 2.18 # Discord alert: off # Email alert: off # IFTTT alert: off @@ -514,7 +588,7 @@ fn_info_message_script(){ fn_info_message_backup(){ # # Backups - # ===================================== + # ================================= # No. of backups: 1 # Latest backup: # date: Fri May 6 18:34:19 UTC 2016 @@ -546,7 +620,7 @@ fn_info_message_backup(){ fn_info_message_commandlineparms(){ # # Command-line Parameters - # ===================================== + # ================================= # ./run_server_x86.sh +set net_strict 1 echo -e "" @@ -556,41 +630,41 @@ fn_info_message_commandlineparms(){ if [ "${serverpassword}" == "NOT SET" ]; then unset serverpassword fi - fn_parms - echo -e "${preexecutable} ${executable} ${parms}" + fn_reload_startparameters + echo -e "${preexecutable} ${executable} ${startparameters}" } fn_info_message_ports(){ + # # Ports - # ===================================== + # ================================= # Change ports by editing the parameters in: # /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg - echo -e "" echo -e "${lightgreen}Ports${default}" fn_messages_separator echo -e "${lightblue}Change ports by editing the parameters in:${default}" - parmslocation="${red}UNKNOWN${default}" + startparameterslocation="${red}UNKNOWN${default}" # engines/games that require editing in the config file. local ports_edit_array=( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "Barotrauma" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Minecraft Bedrock" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "Vintage Story" "wurm") for port_edit in "${ports_edit_array[@]}"; do if [ "${shortname}" == "ut3" ]; then - parmslocation="${servercfgdir}/UTWeb.ini" + startparameterslocation="${servercfgdir}/UTWeb.ini" elif [ "${shortname}" == "kf2" ]; then - parmslocation="${servercfgdir}/LinuxServer-KFEngine.ini\n${servercfgdir}/KFWeb.ini" + startparameterslocation="${servercfgdir}/LinuxServer-KFEngine.ini\n${servercfgdir}/KFWeb.ini" elif [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then - parmslocation="${servercfgfullpath}" + startparameterslocation="${servercfgfullpath}" fi done # engines/games that require editing the start parameters. local ports_edit_array=( "Avorion" "col" "goldsrc" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "qfusion" "Rust" "scpsl" "scpslsm" "Soldat" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned" "vh" ) for port_edit in "${ports_edit_array[@]}"; do if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]||[ "${shortname}" == "${port_edit}" ]; then - parmslocation="${configdirserver}" + startparameterslocation="${configdirserver}" fi done - echo -e "${parmslocation}" + echo -e "${startparameterslocation}" echo -e "" echo -e "${lightblue}Useful port diagnostic command:${default}" } @@ -598,9 +672,9 @@ fn_info_message_ports(){ fn_info_message_statusbottom(){ echo -e "" if [ "${status}" == "0" ]; then - echo -e "${lightblue}Status:\t${red}OFFLINE${default}" + echo -e "${lightblue}Status:\t${red}STOPPED${default}" else - echo -e "${lightblue}Status:\t${green}ONLINE${default}" + echo -e "${lightblue}Status:\t${green}STARTED${default}" fi echo -e "" } @@ -1068,6 +1142,7 @@ fn_info_message_rust(){ echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" echo -e "> Game/Query\tINBOUND\t${port}\tudp" echo -e "> RCON\tINBOUND\t${rconport}\ttcp" + echo -e "> App\tINBOUND\t${appport}\ttcp" } | column -s $'\t' -t } @@ -1394,7 +1469,7 @@ fn_info_message_mta(){ echo -e "" { echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}" - echo -e "> Game/Query\tOUTBOUND\t${port}\tudp" + echo -e "> Game/Query\tINBOUND\t${port}\tudp" echo -e "> HTTP Server\tINBOUND\t${httpport}\ttcp" if [ "${ase}" == "Enabled" ]; then echo -e "> Query Port\tOUTBOUND\t${queryport}\tudp" @@ -1536,7 +1611,7 @@ fn_info_message_select_engine(){ fn_info_message_justcause3 elif [ "${shortname}" == "kf2" ]; then fn_info_message_kf2 - elif [ "${shortname}" == "mc" ]; then + elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then fn_info_message_minecraft elif [ "${shortname}" == "mcb" ]; then fn_info_message_minecraft_bedrock @@ -1630,50 +1705,3 @@ fn_info_message_select_engine(){ fn_print_error_nl "Unable to detect server engine." fi } - -# Separator is different for details -fn_messages_separator(){ - if [ "${commandname}" == "details" ]; then - printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = - else - echo -e "=================================" - fi -} - -# Removes the passwords form all but details -fn_info_message_password_strip(){ - if [ "${commandname}" != "DETAILS" ]; then - if [ "${serverpassword}" ]; then - serverpassword="********" - fi - - if [ "${rconpassword}" ]; then - rconpassword="********" - fi - - if [ "${adminpassword}" ]; then - adminpassword="********" - fi - - if [ "${statspassword}" ]; then - statspassword="********" - fi - - if [ "${webadminpass}" ]; then - webadminpass="********" - fi - - if [ "${telnetpass}" ]; then - telnetpass="********" - fi - - if [ "${wsapikey}" ]; then - wsapikey="********" - fi - - if [ "${gslt}" ]; then - gslt="********" - fi - - fi -} diff --git a/lgsm/functions/info_parms.sh b/lgsm/functions/info_parms.sh index f0e364950..86a1cf480 100755 --- a/lgsm/functions/info_parms.sh +++ b/lgsm/functions/info_parms.sh @@ -143,19 +143,16 @@ fn_info_parms_rust(){ servername=${servername:-"NOT SET"} port=${port:-"0"} queryport=${port:-"0"} + appport=${appport:-"0"} rconport=${rconport:-"0"} + gamemode=${gamemode:-"NOT SET"} + maxplayers=${maxplayers:-"0"} rconpassword=${rconpassword:-"NOT SET"} rconweb=${rconweb:-"NOT SET"} - maxplayers=${maxplayers:-"0"} - saveinterval=${saveinterval:-"0"} tickrate=${tickrate:-"0"} - # Part of random seed feature. - if [ -z "${seed}" ]; then - if [ ! -f "${datadir}/${selfname}-seed.txt" ]; then - shuf -i 1-2147483647 -n 1 > "${datadir}/${selfname}-seed.txt" - fi - seed=$(cat "${datadir}/${selfname}-seed.txt") - fi + saveinterval=${saveinterval:-"0"} + serverlevel=${serverlevel:-"NOT SET"} + worldsize=${worldsize:-"0"} } fn_info_parms_samp(){ @@ -245,7 +242,11 @@ fn_info_parms_ut(){ fn_info_parms_vh(){ port=${port:-"0"} - queryport=$((port+1)) + if [ "${public}" != "0" ]; then + queryport=$((port+1)) + else + querymode="1" + fi gameworld=${gameworld:-"NOT SET"} serverpassword=${serverpassword:-"NOT SET"} servername=${servername:-"NOT SET"} diff --git a/lgsm/functions/install_config.sh b/lgsm/functions/install_config.sh index 47c0922b8..9b5ef01cd 100755 --- a/lgsm/functions/install_config.sh +++ b/lgsm/functions/install_config.sh @@ -514,7 +514,7 @@ elif [ "${shortname}" == "l4d2" ]; then fn_default_config_remote fn_set_config_vars fn_list_config_locations -elif [ "${shortname}" == "mc" ]; then +elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then gamedirname="Minecraft" array_configs+=( server.properties ) fn_fetch_default_config @@ -829,6 +829,12 @@ elif [ "${shortname}" == "wf" ]; then fn_default_config_remote fn_set_config_vars fn_list_config_locations +elif [ "${shortname}" == "wmc" ]; then + gamedirname="Waterfall" + array_configs+=( config.yml ) + fn_fetch_default_config + fn_default_config_remote + fn_set_config_vars elif [ "${shortname}" == "wurm" ]; then gamedirname="WurmUnlimited" array_configs+=( server.cfg ) diff --git a/lgsm/functions/install_eula.sh b/lgsm/functions/install_eula.sh index 0e6b8bd9b..d7c0b0b7a 100755 --- a/lgsm/functions/install_eula.sh +++ b/lgsm/functions/install_eula.sh @@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" if [ "${shortname}" == "ts3" ]; then eulaurl="https://www.teamspeak.com/en/privacy-and-terms" -elif [ "${shortname}" == "mc" ]; then +elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then eulaurl="https://account.mojang.com/documents/minecraft_eula" elif [ "${shortname}" == "ut" ]; then eulaurl="https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula" @@ -41,7 +41,7 @@ fi if [ "${shortname}" == "ts3" ]; then touch "${executabledir}/.ts3server_license_accepted" -elif [ "${shortname}" == "mc" ]; then +elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then touch "${serverfiles}/eula.txt" echo -e "eula=true" > "${serverfiles}/eula.txt" elif [ "${shortname}" == "ut" ]; then diff --git a/lgsm/functions/install_modules.sh b/lgsm/functions/install_modules.sh deleted file mode 100755 index af1050a94..000000000 --- a/lgsm/functions/install_modules.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# LinuxGSM install_modules.sh module -# Author: Daniel Gibbs -# Contributors: http://linuxgsm.com/contrib -# Website: https://linuxgsm.com -# Description: Downloads all modules on install. - -functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" - -echo -e "" -echo -e "${lightyellow}Downloading LinuxGSM Modules${default}" -echo -e "=================================" - -fn_fetch_file "https://github.com/GameServerManagers/LinuxGSM/archive/master.tar.gz" "${tmpdir}" "master.tar.gz" "nochmodx" "norun" "noforce" "nohash" -fn_dl_extract "${tmpdir}" "master.tar.gz" "${tmpdir}" -cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.sh "${functionsdir}" -cp "${tmpdir}/LinuxGSM-master/lgsm/functions"/*.py "${functionsdir}" -chmod +x "${functionsdir}"/* -command_update_linuxgsm.sh -fn_firstcommand_reset diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index c7a6a3097..b6b9f5240 100755 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -27,7 +27,7 @@ fn_install_server_files(){ elif [ "${shortname}" == "codwaw" ]; then remote_fileurl="http://linuxgsm.download/CallOfDutyWorldAtWar/codwaw-lnxded-1.7-full.tar.xz"; local_filedir="${tmpdir}"; local_filename="codwaw-lnxded-1.7-full.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="2c6be1bb66ea631b9b2e7ae6216c6680" elif [ "${shortname}" == "etl" ]; then - remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.76-i386-et-260b.tar.xz"; local_filedir="${tmpdir}"; local_filename="etlegacy-v2.75-i386-et-260b.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="178a00233cec1e25b69d130107ce1a79" + remote_fileurl="http://linuxgsm.download/WolfensteinEnemyTerritory/etlegacy-v2.77.1-i386-et-260b.tar.xz"; local_filedir="${tmpdir}"; local_filename="etlegacy-v2.77.1-i386-et-260b.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="cc307a9232abd3999be499b42d8e4ea8" elif [ "${shortname}" == "mohaa" ]; then remote_fileurl="http://linuxgsm.download/MedalofHonorAlliedAssault/moh_revival_v1.12_RC3.5.1.tar.xz"; local_filedir="${tmpdir}"; local_filename="moh_revival_v1.12_RC3.5.1.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="7c664538999252eeaf2b6d9949416480" elif [ "${shortname}" == "ns" ]; then @@ -49,7 +49,7 @@ fn_install_server_files(){ elif [ "${shortname}" == "ut2k4" ]; then remote_fileurl="http://linuxgsm.download/UnrealTournament2004/ut2004-server-3369-3-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut2004-server-3369-3-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="9fceaab68554749f4b45be66613b9a15" elif [ "${shortname}" == "ut99" ]; then - remote_fileurl="http://linuxgsm.download/UnrealTournament99/ut99-server-469a-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut99-server-469a-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="e3f2ffaab8e23b98d9e825d0244e8b9d" + remote_fileurl="http://linuxgsm.download/UnrealTournament99/ut99-server-469b-ultimate-linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="ut99-server-469b-ultimate-linux.tar.xz"; chmodx="nochmodx" run="norun"; force="noforce"; md5="dba3f1122a5e60ee45ece7422fcf78f5" elif [ "${shortname}" == "ut" ]; then remote_fileurl="http://linuxgsm.download/UnrealTournament/UnrealTournament-Server-XAN-3525360-Linux.tar.xz"; local_filedir="${tmpdir}"; local_filename="UnrealTournament-Server-XAN-3525360-Linux.tar.xz"; chmodx="noexecute" run="norun"; force="noforce"; md5="41dd92015713a78211eaccf503b72393" elif [ "${shortname}" == "ut3" ]; then @@ -83,6 +83,11 @@ elif [ "${shortname}" == "mc" ]; then update_minecraft.sh elif [ "${shortname}" == "mcb" ]; then update_minecraft_bedrock.sh +elif [ "${shortname}" == "pmc" ]; then + install_eula.sh + update_papermc.sh +elif [ "${shortname}" == "wmc" ]; then + update_papermc.sh elif [ "${shortname}" == "mumble" ]; then update_mumble.sh elif [ "${shortname}" == "mta" ]; then diff --git a/lgsm/functions/query_gamedig.sh b/lgsm/functions/query_gamedig.sh index 4d479a4c0..123d8c86c 100755 --- a/lgsm/functions/query_gamedig.sh +++ b/lgsm/functions/query_gamedig.sh @@ -46,7 +46,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; # maxplayers. gdmaxplayers=$(echo "${gamedigraw}" | jq -re '.maxplayers') if [ "${gdmaxplayers}" == "null" ]; then - unset maxplayers + unset gdmaxplayers elif [ "${gdmaxplayers}" == "[]" ]; then gdmaxplayers=0 fi @@ -68,5 +68,11 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ]; if [ "${gdbots}" == "null" ]||[ "${gdbots}" == "0" ]; then unset gdbots fi + + # server version. + gdversion=$(echo "${gamedigraw}" | jq -re '.raw.version') + if [ "${gdversion}" == "null" ]||[ "${gdversion}" == "0" ]; then + unset gdversion + fi fi fi diff --git a/lgsm/functions/update_papermc.sh b/lgsm/functions/update_papermc.sh new file mode 100644 index 000000000..2e669d93d --- /dev/null +++ b/lgsm/functions/update_papermc.sh @@ -0,0 +1,160 @@ +#!/bin/bash +# LinuxGSM update_papermc.sh function +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Handles updating of PaperMC and Waterfall servers. + +local commandname="UPDATE" +local commandaction="Update" +local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +fn_update_papermc_dl(){ + # get build info + builddata=$(curl -s "https://${remotelocation}/api/v2/projects/${paperproject}/versions/${paperversion}/builds/${remotebuild}" | jq '.downloads' ) + buildname=$(echo -e "${builddata}" | jq -r '.application.name') + buildsha256=$(echo -e "${builddata}" | jq -r '.application.sha256') + + fn_fetch_file "https://${remotelocation}/api/v2/projects/${paperproject}/versions/${paperversion}/builds/${remotebuild}/downloads/${buildname}" "" "" "" "${tmpdir}" "${buildname}" "nochmodx" "norun" "force" "${buildsha256}" + + echo -e "copying to ${serverfiles}...\c" + cp -f "${tmpdir}/${buildname}" "${serverfiles}/${executable#./}" + local exitcode=$? + if [ "${exitcode}" == "0" ]; then + fn_print_ok_eol_nl + fn_script_log_pass "Copying to ${serverfiles}" + chmod u+x "${serverfiles}/${executable#./}" + echo "${remotebuild}" > "${localversionfile}" + fn_clear_tmp + else + fn_print_fail_eol_nl + fn_script_log_fatal "Copying to ${serverfiles}" + core_exit.sh + fi +} + +fn_update_papermc_localbuild(){ + # Gets local build info. + fn_print_dots "Checking for update: ${remotelocation}: checking local build" + sleep 0.5 + + if [ ! -f "${localversionfile}" ]; then + fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no local build files" + fn_script_log_error "No local build file found" + else + localbuild=$(head -n 1 "${localversionfile}") + fi + + if [ -z "${localbuild}" ]; then + localbuild="0" + fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info" + fn_script_log_error "Missing local build info, Set localbuild to 0" + else + fn_print_ok "Checking for update: ${remotelocation}: checking local build" + fn_script_log_pass "Checking local build" + fi + sleep 0.5 +} + +fn_update_papermc_remotebuild(){ + # Gets remote build info. + remotebuild=$(curl -s "https://${remotelocation}/api/v2/projects/${paperproject}/versions/${paperversion}" | jq -r '.builds[-1]') + + # Checks if remotebuild variable has been set. + if [ -z "${remotebuild}" ]||[ "${remotebuild}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fatal "Unable to get remote build" + core_exit.sh + else + fn_print_ok "Got build for version ${paperversion}" + fn_script_log "Got build for version ${paperversion}" + fi +} + +fn_update_papermc_compare(){ + fn_print_dots "Checking for update: ${remotelocation}" + sleep 0.5 + if [ "${localbuild}" != "${remotebuild}" ]||[ "${forceupdate}" == "1" ]; then + fn_print_ok_nl "Checking for update: ${remotelocation}" + echo -en "\n" + echo -e "Update available for version ${paperversion}" + echo -e "* Local build: ${red}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + fn_script_log_info "Update available for version ${paperversion}" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuild}" + fn_script_log_info "${localbuild} > ${remotebuild}" + echo -en "\n" + echo -en "applying update.\r" + echo -en "\n" + + unset updateonstart + + check_status.sh + # If server stopped. + if [ "${status}" == "0" ]; then + fn_update_papermc_dl + # If server started. + else + exitbypass=1 + command_stop.sh + exitbypass=1 + fn_update_papermc_dl + exitbypass=1 + command_start.sh + fi + alert="update" + alert.sh + else + fn_print_ok_nl "Checking for update: ${remotelocation}" + echo -en "\n" + echo -e "No update available for version ${paperversion}" + echo -e "* Local build: ${green}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuild}${default}" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuild}" + fi +} + +# The location where the builds are checked and downloaded. +remotelocation="papermc.io" + +if [ "${shortname}" == "pmc" ]; then + paperproject="paper" +elif [ "${shortname}" == "wmc" ]; then + paperproject="waterfall" +fi + +localversionfile="${datadir}/${paperproject}-version" + +# check if datadir was created, if not create it +if [ ! -d "${datadir}" ]; then + mkdir -p "${datadir}" +fi + +# check version if the user did set one and check it +if [ "${mcversion}" == "latest" ]; then + paperversion=$(curl -s "https://${remotelocation}/api/v2/projects/${paperproject}" | jq -r '.versions[-1]') +else + # check if version there for the download from the api + paperversion=$(curl -s "https://${remotelocation}/api/v2/projects/${paperproject}" | jq -r -e --arg mcversion "${mcversion}" '.versions[]|select(. == $mcversion)') + if [ -z "${paperversion}" ]; then + # user passed version does not exist + fn_print_error_nl "Version ${mcversion} not available from ${remotelocation}" + fn_script_log_error "Version ${mcversion} not available from ${remotelocation}" + core_exit.sh + fi +fi + +if [ "${firstcommandname}" == "INSTALL" ]; then + fn_update_papermc_remotebuild + fn_update_papermc_dl +else + fn_print_dots "Checking for update: ${remotelocation}" + fn_script_log_info "Checking for update: ${remotelocation}" + sleep 0.5 + fn_update_papermc_localbuild + fn_update_papermc_remotebuild + fn_update_papermc_compare +fi diff --git a/lgsm/functions/update_ts3.sh b/lgsm/functions/update_ts3.sh index 51192a331..782a138d1 100644 --- a/lgsm/functions/update_ts3.sh +++ b/lgsm/functions/update_ts3.sh @@ -103,7 +103,7 @@ fn_update_ts3_localbuild(){ fn_update_ts3_remotebuild(){ # Gets remote build info. - if [ "${ts3arch}" == "x86_64" ]; then + if [ "${ts3arch}" == "amd64" ]; then remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86_64.version') elif [ "${ts3arch}" == "x86" ]; then remotebuild=$(curl -s "https://www.teamspeak.com/versions/server.json" | jq -r '.linux.x86.version') diff --git a/linuxgsm.sh b/linuxgsm.sh index 36ef5764c..c4df71037 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v21.1.3" +version="v21.2.3" shortname="core" gameservername="core" commandname="CORE" @@ -54,7 +54,7 @@ githubbranch="master" # Core function that is required first. core_functions.sh(){ functionfile="${FUNCNAME[0]}" - fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nohash" + fn_bootstrap_fetch_file_github "lgsm/functions" "core_functions.sh" "${functionsdir}" "chmodx" "run" "noforcedl" "nomd5" } # Bootstrap @@ -331,7 +331,7 @@ fi # LinuxGSM installer mode. if [ "${shortname}" == "core" ]; then # Download the latest serverlist. This is the complete list of all supported servers. - fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nohash" + fn_bootstrap_fetch_file_github "lgsm/data" "serverlist.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5" if [ ! -f "${serverlist}" ]; then echo -e "[ FAIL ] serverlist.csv could not be loaded." exit 1 @@ -376,7 +376,7 @@ else # Load the default config. If missing download it. If changed reload it. if [ ! -f "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" ]; then mkdir -p "${configdirdefault}/config-lgsm/${gameservername}" - fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nohash" + fn_fetch_config "lgsm/config-default/config-lgsm/${gameservername}" "_default.cfg" "${configdirdefault}/config-lgsm/${gameservername}" "_default.cfg" "nochmodx" "norun" "noforcedl" "nomd5" fi if [ ! -f "${configdirserver}/_default.cfg" ]; then mkdir -p "${configdirserver}" @@ -410,7 +410,7 @@ else source "${configdirserver}/_default.cfg" # Load the common.cfg config. If missing download it. if [ ! -f "${configdirserver}/common.cfg" ]; then - fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nohash" + fn_fetch_config "lgsm/config-default/config-lgsm" "common-template.cfg" "${configdirserver}" "common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" # shellcheck source=/dev/null source "${configdirserver}/common.cfg" else @@ -419,7 +419,7 @@ else fi # Load the secrets-common.cfg config. If missing download it. if [ ! -f "${configdirserver}/secrets-common.cfg" ]; then - fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-common-template.cfg" "${configdirserver}" "secrets-common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nohash" + fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-common-template.cfg" "${configdirserver}" "secrets-common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5" # shellcheck source=/dev/null source "${configdirserver}/secrets-common.cfg" else @@ -428,7 +428,7 @@ else fi # Load the instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then - fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nohash" + fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" # shellcheck source=/dev/null source "${configdirserver}/${selfname}.cfg" else @@ -437,29 +437,69 @@ else fi # Load the secrets-instance.cfg config. If missing download it. if [ ! -f "${configdirserver}/secrets-${selfname}.cfg" ]; then - fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-instance-template.cfg" "${configdirserver}" "secrets-${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nohash" + fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-instance-template.cfg" "${configdirserver}" "secrets-${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5" # shellcheck source=/dev/null source "${configdirserver}/secrets-${selfname}.cfg" else # shellcheck source=/dev/null source "${configdirserver}/secrets-${selfname}.cfg" fi - # Use eval if startparameters are only in _default.cfg to ensure all vars in startparameters are set. - if ! grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/common.cfg" "${configdirserver}/${selfname}.cfg" "${configdirserver}/secrets-common.cfg" "${configdirserver}/secrets-${selfname}.cfg"; then + + # Reloads start parameter to ensure all vars in startparameters are set. + # Will reload the last defined startparameter. + fn_reload_startparameters(){ + # reload Wurm config. if [ "${shortname}" == "wurm" ]; then # shellcheck source=/dev/null source "${servercfgfullpath}" fi + # reload startparameters. + if grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/secrets-${selfname}.cfg"; then + eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/secrets-${selfname}.cfg")" + elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/${selfname}.cfg"; then + eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/${selfname}.cfg")" + elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/secrets-common.cfg"; then + eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/secrets-common.cfg")" + elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/common.cfg"; then + eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/common.cfg")" + elif grep -qE "^[[:blank:]]*startparameters=" "${configdirserver}/_default.cfg"; then + eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/_default.cfg")" + fi - if [ -n "${preexecutable}" ]; then +# reload preexecutable. + if grep -qE "^[[:blank:]]*preexecutable=" "${configdirserver}/secrets-${selfname}.cfg"; then + eval preexecutable="$(sed -nr 's/^ *preexecutable=(.*)$/\1/p' "${configdirserver}/secrets-${selfname}.cfg")" + elif grep -qE "^[[:blank:]]*preexecutable=" "${configdirserver}/${selfname}.cfg"; then + eval preexecutable="$(sed -nr 's/^ *preexecutable=(.*)$/\1/p' "${configdirserver}/${selfname}.cfg")" + elif grep -qE "^[[:blank:]]*preexecutable=" "${configdirserver}/secrets-common.cfg"; then + eval preexecutable="$(sed -nr 's/^ *preexecutable=(.*)$/\1/p' "${configdirserver}/secrets-common.cfg")" + elif grep -qE "^[[:blank:]]*preexecutable=" "${configdirserver}/common.cfg"; then + eval preexecutable="$(sed -nr 's/^ *preexecutable=(.*)$/\1/p' "${configdirserver}/common.cfg")" + elif grep -qE "^[[:blank:]]*preexecutable=" "${configdirserver}/_default.cfg"; then eval preexecutable="$(sed -nr 's/^ *preexecutable=(.*)$/\1/p' "${configdirserver}/_default.cfg")" fi - eval startparameters="$(sed -nr 's/^ *startparameters=(.*)$/\1/p' "${configdirserver}/_default.cfg")" - fi + + # For legacy configs that still use parms= 15.03.21 + if grep -qE "^[[:blank:]]*parms=" "${configdirserver}/secrets-${selfname}.cfg"; then + eval parms="$(sed -nr 's/^ *parms=(.*)$/\1/p' "${configdirserver}/secrets-${selfname}.cfg")" + elif grep -qE "^[[:blank:]]*parms=" "${configdirserver}/${selfname}.cfg"; then + eval parms="$(sed -nr 's/^ *parms=(.*)$/\1/p' "${configdirserver}/${selfname}.cfg")" + elif grep -qE "^[[:blank:]]*parms=" "${configdirserver}/secrets-common.cfg"; then + eval parms="$(sed -nr 's/^ *parms=(.*)$/\1/p' "${configdirserver}/secrets-common.cfg")" + elif grep -qE "^[[:blank:]]*parms=" "${configdirserver}/common.cfg"; then + eval parms="$(sed -nr 's/^ *parms=(.*)$/\1/p' "${configdirserver}/common.cfg")" + elif grep -qE "^[[:blank:]]*parms=" "${configdirserver}/_default.cfg"; then + eval parms="$(sed -nr 's/^ *parms=(.*)$/\1/p' "${configdirserver}/_default.cfg")" + fi + + if [ -n "${parms}" ]; then + startparameters="${parms}" + fi + } # Load the linuxgsm.sh in to tmpdir. If missing download it. if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then - fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nohash" + fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "chmodx" "norun" "noforcedl" "nomd5" fi # Enables ANSI colours from core_messages.sh. Can be disabled with ansi=off. diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index a2099236b..f31d4ac96 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v21.1.3" +version="v21.2.3" shortname="fctr" gameservername="fctrserver" commandname="CORE" @@ -466,9 +466,9 @@ fi fn_currentstatus_tmux(){ check_status.sh if [ "${status}" != "0" ]; then - currentstatus="ONLINE" + currentstatus="STARTED" else - currentstatus="OFFLINE" + currentstatus="STOPPED" fi } @@ -483,7 +483,7 @@ fn_setstatus(){ fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" - if [ "${requiredstatus}" == "ONLINE" ]; then + if [ "${requiredstatus}" == "STARTED" ]; then (command_start.sh > /dev/null 2>&1) else (command_stop.sh > /dev/null 2>&1) @@ -749,7 +749,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -768,7 +768,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server while already running." echo -e "Command: ./${gameservername} start" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -787,7 +787,7 @@ echo -e "=================================" echo -e "Description:" echo -e "will update server on start." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -806,7 +806,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server." echo -e "Command: ./${gameservername} stop" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -825,7 +825,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server while already stopped." echo -e "Command: ./${gameservername} stop" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -844,7 +844,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename}." echo -e "Command: ./${gameservername} restart" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -863,7 +863,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename} while already stopped." echo -e "Command: ./${gameservername} restart" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -886,7 +886,7 @@ echo -e "=================================" echo -e "Description:" echo -e "check for updates." echo -e "Command: ./${gameservername} update" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -906,7 +906,7 @@ echo -e "Description:" echo -e "update LinuxGSM." echo -e "" echo -e "Command: ./jc2server update-lgam" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -933,7 +933,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor server while already running." echo -e "Command: ./${gameservername} monitor" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -952,7 +952,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus fn_print_info_nl "creating lockfile." date '+%s' > "${lockdir}/${selfname}.lock" @@ -975,7 +975,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -994,7 +994,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} test-alert" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1017,7 +1017,7 @@ echo -e "=================================" echo -e "Description:" echo -e "display details." echo -e "Command: ./${gameservername} details" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1036,7 +1036,7 @@ echo -e "=================================" echo -e "Description:" echo -e "post details." echo -e "Command: ./${gameservername} postdetails" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1059,7 +1059,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run a backup." echo -e "Command: ./${gameservername} backup" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus echo -e "test de-activated until issue #1839 fixed" #(command_backup.sh) @@ -1078,7 +1078,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect glibc." echo -e "Command: ./${gameservername} detect-glibc" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1097,7 +1097,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect ldd." echo -e "Command: ./${gameservername} detect-ldd" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1116,7 +1116,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect dependencies." echo -e "Command: ./${gameservername} detect-deps" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1135,7 +1135,7 @@ echo -e "=================================" echo -e "Description:" echo -e "raw query output." echo -e "Command: ./${gameservername} query-raw" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1159,7 +1159,7 @@ echo -e "=================================" echo -e "Description:" echo -e "donate." echo -e "Command: ./${gameservername} donate" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1177,7 +1177,7 @@ echo -e "=================================" echo -e "Server Tests - Complete!" echo -e "Using: ${gamename}" echo -e "=================================" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus core_exit.sh diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index f151dda65..7203ac0d2 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v21.1.3" +version="v21.2.3" shortname="jc2" gameservername="jc2server" commandname="CORE" @@ -467,9 +467,9 @@ fi fn_currentstatus_tmux(){ check_status.sh if [ "${status}" != "0" ]; then - currentstatus="ONLINE" + currentstatus="STARTED" else - currentstatus="OFFLINE" + currentstatus="STOPPED" fi } @@ -484,7 +484,7 @@ fn_setstatus(){ fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" - if [ "${requiredstatus}" == "ONLINE" ]; then + if [ "${requiredstatus}" == "STARTED" ]; then (command_start.sh > /dev/null 2>&1) else (command_stop.sh > /dev/null 2>&1) @@ -754,7 +754,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -773,7 +773,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server while already running." echo -e "Command: ./${gameservername} start" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -792,7 +792,7 @@ echo -e "=================================" echo -e "Description:" echo -e "will update server on start." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -811,7 +811,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server." echo -e "Command: ./${gameservername} stop" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -830,7 +830,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server while already stopped." echo -e "Command: ./${gameservername} stop" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -849,7 +849,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename}." echo -e "Command: ./${gameservername} restart" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -868,7 +868,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename} while already stopped." echo -e "Command: ./${gameservername} restart" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -891,7 +891,7 @@ echo -e "=================================" echo -e "Description:" echo -e "check for updates." echo -e "Command: ./${gameservername} update" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -910,7 +910,7 @@ echo -e "=================================" echo -e "Description:" echo -e "change the buildid tricking SteamCMD to update." echo -e "Command: ./jc2server update" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus fn_print_info_nl "changed buildid to 0." sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf" @@ -931,7 +931,7 @@ echo -e "=================================" echo -e "Description:" echo -e "change the buildid tricking SteamCMD to update server while already running." echo -e "Command: ./jc2server update" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus fn_print_info_nl "changed buildid to 0." sed -i 's/[0-9]\+/0/' "${serverfiles}/steamapps/appmanifest_${appid}.acf" @@ -952,7 +952,7 @@ echo -e "=================================" echo -e "Description:" echo -e "removing appmanifest file will cause script to repair." echo -e "Command: ./jc2server update" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus fn_print_info_nl "removed appmanifest_${appid}.acf." rm --verbose "${serverfiles:?}/steamapps/appmanifest_${appid}.acf" @@ -973,7 +973,7 @@ echo -e "=================================" echo -e "Description:" echo -e "force-update bypassing update check." echo -e "Command: ./jc2server force-update" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -992,7 +992,7 @@ echo -e "=================================" echo -e "Description:" echo -e "force-update bypassing update check server while already running." echo -e "Command: ./jc2server force-update" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1011,7 +1011,7 @@ echo -e "=================================" echo -e "Description:" echo -e "validate server files." echo -e "Command: ./jc2server validate" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1031,7 +1031,7 @@ echo -e "Description:" echo -e "validate server files while server already running." echo -e "" echo -e "Command: ./jc2server validate" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1051,7 +1051,7 @@ echo -e "Description:" echo -e "update LinuxGSM." echo -e "" echo -e "Command: ./jc2server update-lgam" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1092,7 +1092,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor server while already running." echo -e "Command: ./${gameservername} monitor" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1111,7 +1111,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus fn_print_info_nl "creating lockfile." date '+%s' > "${lockdir}/${selfname}.lock" @@ -1134,7 +1134,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1153,7 +1153,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} test-alert" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus cp "${servercfgfullpath}" "config.lua" sed -i 's/[0-9]\+/0/' "${servercfgfullpath}" @@ -1183,7 +1183,7 @@ echo -e "=================================" echo -e "Description:" echo -e "display details." echo -e "Command: ./${gameservername} details" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1202,7 +1202,7 @@ echo -e "=================================" echo -e "Description:" echo -e "post details." echo -e "Command: ./${gameservername} postdetails" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1225,7 +1225,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run a backup." echo -e "Command: ./${gameservername} backup" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus echo -e "test de-activated until issue #1839 fixed" #(command_backup.sh) @@ -1244,7 +1244,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect glibc." echo -e "Command: ./${gameservername} detect-glibc" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1263,7 +1263,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect ldd." echo -e "Command: ./${gameservername} detect-ldd" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1282,7 +1282,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect dependencies." echo -e "Command: ./${gameservername} detect-deps" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1301,7 +1301,7 @@ echo -e "=================================" echo -e "Description:" echo -e "raw query output." echo -e "Command: ./${gameservername} query-raw" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1324,7 +1324,7 @@ echo -e "=================================" echo -e "Description:" echo -e "donate." echo -e "Command: ./${gameservername} donate" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1342,6 +1342,6 @@ echo -e "=================================" echo -e "Server Tests - Complete!" echo -e "Using: ${gamename}" echo -e "=================================" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus core_exit.sh diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 43b72c844..420732839 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v21.1.3" +version="v21.2.3" shortname="mc" gameservername="mcserver" commandname="CORE" @@ -467,9 +467,9 @@ fi fn_currentstatus_tmux(){ check_status.sh if [ "${status}" != "0" ]; then - currentstatus="ONLINE" + currentstatus="STARTED" else - currentstatus="OFFLINE" + currentstatus="STOPPED" fi } @@ -484,7 +484,7 @@ fn_setstatus(){ fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" - if [ "${requiredstatus}" == "ONLINE" ]; then + if [ "${requiredstatus}" == "STARTED" ]; then (command_start.sh > /dev/null 2>&1) else (command_stop.sh > /dev/null 2>&1) @@ -748,7 +748,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -767,7 +767,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server while already running." echo -e "Command: ./${gameservername} start" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -786,7 +786,7 @@ echo -e "=================================" echo -e "Description:" echo -e "will update server on start." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -804,7 +804,7 @@ echo -e "=================================" echo -e "Description:" echo -e "give time for server to fully start." echo -e "Command: sleep 30" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus sleep 30 @@ -814,7 +814,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server." echo -e "Command: ./${gameservername} stop" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -833,7 +833,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server while already stopped." echo -e "Command: ./${gameservername} stop" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -852,7 +852,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename}." echo -e "Command: ./${gameservername} restart" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -871,7 +871,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename} while already stopped." echo -e "Command: ./${gameservername} restart" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -894,7 +894,7 @@ echo -e "=================================" echo -e "Description:" echo -e "check for updates." echo -e "Command: ./${gameservername} update" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -914,7 +914,7 @@ echo -e "Description:" echo -e "update LinuxGSM." echo -e "" echo -e "Command: ./jc2server update-lgam" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -955,7 +955,7 @@ echo -e "=================================" echo -e "Description:" echo -e "give time for server to fully start." echo -e "Command: sleep 30" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus sleep 30 @@ -965,7 +965,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor server while already running." echo -e "Command: ./${gameservername} monitor" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -984,7 +984,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus fn_print_info_nl "creating lockfile." date '+%s' > "${lockdir}/${selfname}.lock" @@ -1007,7 +1007,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1026,7 +1026,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} test-alert" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1049,7 +1049,7 @@ echo -e "=================================" echo -e "Description:" echo -e "display details." echo -e "Command: ./${gameservername} details" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1068,7 +1068,7 @@ echo -e "=================================" echo -e "Description:" echo -e "post details." echo -e "Command: ./${gameservername} postdetails" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1091,7 +1091,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run a backup." echo -e "Command: ./${gameservername} backup" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus echo -e "test de-activated until issue #1839 fixed" #(command_backup.sh) @@ -1110,7 +1110,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect glibc." echo -e "Command: ./${gameservername} detect-glibc" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1129,7 +1129,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect ldd." echo -e "Command: ./${gameservername} detect-ldd" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1148,7 +1148,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect dependencies." echo -e "Command: ./${gameservername} detect-deps" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1181,7 +1181,7 @@ echo -e "=================================" echo -e "Description:" echo -e "raw query output." echo -e "Command: ./${gameservername} query-raw" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1204,7 +1204,7 @@ echo -e "=================================" echo -e "Description:" echo -e "donate." echo -e "Command: ./${gameservername} donate" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1222,7 +1222,7 @@ echo -e "=================================" echo -e "Server Tests - Complete!" echo -e "Using: ${gamename}" echo -e "=================================" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus core_exit.sh diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index e6f29d23d..afc68811a 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v21.1.3" +version="v21.2.3" shortname="ts3" gameservername="ts3server" commandname="CORE" @@ -467,9 +467,9 @@ fi fn_currentstatus_tmux(){ check_status.sh if [ "${status}" != "0" ]; then - currentstatus="ONLINE" + currentstatus="STARTED" else - currentstatus="OFFLINE" + currentstatus="STOPPED" fi } @@ -484,7 +484,7 @@ fn_setstatus(){ fn_currentstatus_tmux echo -en "New status: ${currentstatus}\\r" - if [ "${requiredstatus}" == "ONLINE" ]; then + if [ "${requiredstatus}" == "STARTED" ]; then (command_start.sh > /dev/null 2>&1) else (command_stop.sh > /dev/null 2>&1) @@ -748,7 +748,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -767,7 +767,7 @@ echo -e "=================================" echo -e "Description:" echo -e "start ${gamename} server while already running." echo -e "Command: ./${gameservername} start" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -786,7 +786,7 @@ echo -e "=================================" echo -e "Description:" echo -e "will update server on start." echo -e "Command: ./${gameservername} start" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -805,7 +805,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server." echo -e "Command: ./${gameservername} stop" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -824,7 +824,7 @@ echo -e "=================================" echo -e "Description:" echo -e "stop ${gamename} server while already stopped." echo -e "Command: ./${gameservername} stop" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -843,7 +843,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename}." echo -e "Command: ./${gameservername} restart" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -862,7 +862,7 @@ echo -e "=================================" echo -e "Description:" echo -e "restart ${gamename} while already stopped." echo -e "Command: ./${gameservername} restart" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -885,7 +885,7 @@ echo -e "=================================" echo -e "Description:" echo -e "check for updates." echo -e "Command: ./${gameservername} update" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -905,7 +905,7 @@ echo -e "Description:" echo -e "update LinuxGSM." echo -e "" echo -e "Command: ./jc2server update-lgam" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -932,7 +932,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor server while already running." echo -e "Command: ./${gameservername} monitor" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -951,7 +951,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus fn_print_info_nl "creating lockfile." date '+%s' > "${lockdir}/${selfname}.lock" @@ -974,7 +974,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} monitor" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -993,7 +993,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run monitor while server is offline with no lockfile." echo -e "Command: ./${gameservername} test-alert" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1016,7 +1016,7 @@ echo -e "=================================" echo -e "Description:" echo -e "display details." echo -e "Command: ./${gameservername} details" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1035,7 +1035,7 @@ echo -e "=================================" echo -e "Description:" echo -e "post details." echo -e "Command: ./${gameservername} postdetails" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1058,7 +1058,7 @@ echo -e "=================================" echo -e "Description:" echo -e "run a backup." echo -e "Command: ./${gameservername} backup" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus echo -e "test de-activated until issue #1839 fixed" #(command_backup.sh) @@ -1077,7 +1077,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect glibc." echo -e "Command: ./${gameservername} detect-glibc" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1096,7 +1096,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect ldd." echo -e "Command: ./${gameservername} detect-ldd" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1115,7 +1115,7 @@ echo -e "=================================" echo -e "Description:" echo -e "detect dependencies." echo -e "Command: ./${gameservername} detect-deps" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1134,7 +1134,7 @@ echo -e "=================================" echo -e "Description:" echo -e "raw query output." echo -e "Command: ./${gameservername} query-raw" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1157,7 +1157,7 @@ echo -e "=================================" echo -e "Description:" echo -e "donate." echo -e "Command: ./${gameservername} donate" -requiredstatus="ONLINE" +requiredstatus="STARTED" fn_setstatus ( exec 5>"${TRAVIS_BUILD_DIR}/dev-debug.log" @@ -1175,7 +1175,7 @@ echo -e "=================================" echo -e "Server Tests - Complete!" echo -e "Using: ${gamename}" echo -e "=================================" -requiredstatus="OFFLINE" +requiredstatus="STOPPED" fn_setstatus core_exit.sh