From 8673d9b7941ccb70e14f33cce9bee830dec77030 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 21 Jul 2020 12:09:30 +0100 Subject: [PATCH 1/2] fix(rustserver): fix blueprint not being wiped (#2972) Fix blueprint not being wiped on full-wipe Removed reference to random seeds as this feature doesn't exist yet updated command name from wipeall to full-wipe (old commands will still work but are now hidden) --- .../config-lgsm/rustserver/_default.cfg | 32 ++++------------ lgsm/functions/check_config.sh | 7 +--- lgsm/functions/command_wipe.sh | 28 +++++++------- lgsm/functions/core_dl.sh | 38 +++++++++---------- lgsm/functions/core_getopt.sh | 6 +-- 5 files changed, 46 insertions(+), 65 deletions(-) diff --git a/lgsm/config-default/config-lgsm/rustserver/_default.cfg b/lgsm/config-default/config-lgsm/rustserver/_default.cfg index 595cf3864a..280b03033c 100644 --- a/lgsm/config-default/config-lgsm/rustserver/_default.cfg +++ b/lgsm/config-default/config-lgsm/rustserver/_default.cfg @@ -9,41 +9,23 @@ #### Game Server Settings #### ## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters -# More settings available after install in serverfiles/server/rust-server/server.cfg ip="0.0.0.0" port="28015" rconport="28016" appport=28082 rconpassword="CHANGE_ME" -rconweb="1" # Value is: 1 for Facepunch's web panel; 0 for RCON tools like Rusty or Rustadmin +rconweb="1" # Value is: 1 for the Facepunch web panel; 0 for RCON tools like Rusty or Rustadmin. servername="Rust" maxplayers="50" - -# Advanced Start Settings -seed="" # default random; range : 1 to 2147483647 ; used to change or reproduce a procedural map -salt="" # default random; range : unknown range ; used to recover a known setting from an existing map -worldsize="3000" # default 3000; range : 1000 to 6000 ; map size in meters -saveinterval="300" # Auto-save in seconds -tickrate="30" # default 30; range : 15 to 100 +seed="" # range: 1-2147483647, used to reproduce a procedural map. +salt="" # range: unknown, used to recover a known setting from an existing map. +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 Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters fn_parms(){ -# Specific to Rust -if [ "${seed}" ]; then - # If set, then add to start parms - conditionalseed="+server.seed ${seed}" -else - # Keep randomness of the number if not set - conditionalseed="" -fi -if [ "${salt}" ]; then - # If set, then add to start parms - conditionalsalt="+server.salt ${salt}" -else - # Keep randomness of the number if not set - conditionalsalt="" -fi -parms="-batchmode +app.listenip ${ip} +app.port ${appport} +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +server.hostname \"${servername}\" +server.identity \"${selfname}\" ${conditionalseed} ${conditionalsalt} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.web ${rconweb} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile" +parms="-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" } #### LinuxGSM Settings #### diff --git a/lgsm/functions/check_config.sh b/lgsm/functions/check_config.sh index c799904f28..2b4443cb3f 100644 --- a/lgsm/functions/check_config.sh +++ b/lgsm/functions/check_config.sh @@ -20,15 +20,12 @@ fi if [ "${shortname}" == "rust" ]; then if [ -z "${rconpassword}" ]; then fn_print_dots "" - fn_print_fail_nl "RCON password is not set!" - echo -e " * Not setting an RCON password causes issues with ${gamename}" + fn_print_fail_nl "RCON password is not set" fn_script_log_fatal "RCON password is not set" - fn_script_log_fatal "Not setting an RCON password causes issues with ${gamename}" core_exit.sh elif [ "${rconpassword}" == "CHANGE_ME" ]; then fn_print_dots "" - fn_print_warn_nl "Default RCON Password detected!" - echo -e " * Having ${rconpassword} as a password is not very safe." + fn_print_warn_nl "Default RCON Password detected" fn_script_log_warn "Default RCON Password detected" fi fi diff --git a/lgsm/functions/command_wipe.sh b/lgsm/functions/command_wipe.sh index 342a386586..66b335446c 100644 --- a/lgsm/functions/command_wipe.sh +++ b/lgsm/functions/command_wipe.sh @@ -26,7 +26,7 @@ fn_wipe_server_files(){ fn_print_start_nl "Wiping server" fn_script_log_info "Wiping server" # Wipe procedural map. - if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.map")" ]; then + 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" @@ -39,7 +39,7 @@ fn_wipe_server_files(){ fn_script_log_pass "No procedural map file to remove" fi # Wipe procedural map save. - if [ "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then + if [ -n "$(find "${serveridentitydir}" -type f -name "proceduralmap.*.sav")" ]; then echo -en "removing map saves proceduralmap.*.sav file(s)..." fn_sleep_time fn_script_log_info "Removing procedural map save(s): ${serveridentitydir}/proceduralmap.*.sav" @@ -52,7 +52,7 @@ fn_wipe_server_files(){ fn_script_log_pass "No procedural map save to remove" fi # Wipe Barren map. - if [ "$(find "${serveridentitydir}" -type f -name "barren*.map")" ]; then + 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" @@ -65,7 +65,7 @@ fn_wipe_server_files(){ fn_script_log_pass "No barren map file to remove" fi # Wipe barren map save. - if [ "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then + if [ -n "$(find "${serveridentitydir}" -type f -name "barren*.sav")" ]; then echo -en "removing barren map saves barren*.sav file(s)..." fn_sleep_time fn_script_log_info "Removing barren map save(s): ${serveridentitydir}/barren*.sav" @@ -98,7 +98,7 @@ fn_wipe_server_files(){ # We do not print additional information if there is nothing to remove since this might be obsolete. fi # Wipe sv.files. - if [ "$(find "${serveridentitydir}" -type f -name "sv.files.*.db")" ]; then + 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" @@ -108,7 +108,7 @@ fn_wipe_server_files(){ # No further information if not found because it should I could not get this file showing up. fi # Wipe player death files. - if [ "$(find "${serveridentitydir}" -type f -name "player.deaths.*.db")" ]; then + 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" @@ -122,7 +122,7 @@ fn_wipe_server_files(){ fi # Wipe blueprints only if full-wipe command was used. if [ "${fullwipe}" == "1" ]; then - if [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then + if [ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then echo -en "removing blueprints player.blueprints.*.db file(s)..." fn_sleep_time fn_script_log_info "Removing blueprint file(s): ${serveridentitydir}/player.blueprints.*.db" @@ -134,7 +134,7 @@ fn_wipe_server_files(){ fn_sleep_time fn_script_log_pass "No blueprint file to remove" fi - elif [ "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then + elif [ -n "$(find "${serveridentitydir}" -type f -name "player.blueprints.*.db")" ]; then echo -e "keeping blueprints" fn_sleep_time fn_script_log_info "Keeping blueprints" @@ -144,8 +144,8 @@ fn_wipe_server_files(){ fn_script_log_pass "No blueprints found" fi # Wipe some logs that might be there. - if [ "$(find "${serveridentitydir}" -type f -name "Log.*.txt")" ]; then - echo -en "removing Log files..." + 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 @@ -204,8 +204,10 @@ if [ -d "${serveridentitydir}/storage" ]||[ -d "${serveridentitydir}/user" ]||[ else fn_wipe_server_files fi - fn_print_ok_nl "" - fn_script_log_pass "Wiping server" + fn_print_complete_nl "Wiping ${selfname}" + fn_script_log_pass "Wiping ${selfname}" +else + fn_print_ok_nl "Wipe not required" + fn_script_log_pass "Wipe not required" fi - core_exit.sh diff --git a/lgsm/functions/core_dl.sh b/lgsm/functions/core_dl.sh index a6521ac035..ae11c4156e 100644 --- a/lgsm/functions/core_dl.sh +++ b/lgsm/functions/core_dl.sh @@ -21,7 +21,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_dl_steamcmd(){ fn_print_start_nl "${remotelocation}" - fn_script_log_info "${commandaction} server: ${remotelocation}" + fn_script_log_info "${commandaction} ${selfname}: ${remotelocation}" if [ -n "${branch}" ]; then echo -e "Branch: ${branch}" fn_script_log_info "Branch: ${branch}" @@ -91,43 +91,43 @@ fn_dl_steamcmd(){ if [ -n "$(grep "Error!" "${steamcmdlog}" | tail -1)" ]||[ -n "$(grep "ERROR!" "${steamcmdlog}" | tail -1)" ]; then # Not enough space. if [ -n "$(grep "0x202" "${steamcmdlog}" | tail -1)" ]; then - fn_print_failure_nl "${commandaction} server: ${remotelocation}: Not enough space to download server files" - fn_script_log_fatal "${commandaction} server: ${remotelocation}: Not enough space to download server files" + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Not enough space to download server files" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Not enough space to download server files" core_exit.sh # Need tp purchase game. elif [ -n "$(grep "No subscription" "${steamcmdlog}" | tail -1)" ]; then - fn_print_failure_nl "${commandaction} server: ${remotelocation}: Steam account does not have a license for the required game" - fn_script_log_fatal "${commandaction} server: ${remotelocation}: Steam account does not have a license for the required game" + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Steam account does not have a license for the required game" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Steam account does not have a license for the required game" core_exit.sh # Two-factor authentication failure elif [ -n "$(grep "Two-factor code mismatch" "${steamcmdlog}" | tail -1)" ]; then - fn_print_failure_nl "${commandaction} server: ${remotelocation}: Two-factor authentication failure" - fn_script_log_fatal "${commandaction} server: ${remotelocation}: Two-factor authentication failure" + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Two-factor authentication failure" core_exit.sh # Incorrect Branch password elif [ -n "$(grep "Password check for AppId" "${steamcmdlog}" | tail -1)" ]; then - fn_print_failure_nl "${commandaction} server: ${remotelocation}: betapassword is incorrect" - fn_script_log_fatal "${commandaction} server: ${remotelocation}: betapassword is incorrect" + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: betapassword is incorrect" core_exit.sh # Update did not finish. elif [ -n "$(grep "0x402" "${steamcmdlog}" | tail -1)" ]||[ -n "$(grep "0x602" "${steamcmdlog}" | tail -1)" ]; then - fn_print_error2_nl "${commandaction} server: ${remotelocation}: Update required but not completed - check network" - fn_script_log_error "${commandaction} server: ${remotelocation}: Update required but not completed - check network" + fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network" + fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Update required but not completed - check network" else - fn_print_error2_nl "${commandaction} server: ${remotelocation}: Unknown error occured" - fn_script_log_error "${commandaction} server: ${remotelocation}: Unknown error occured" + fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" + fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Unknown error occured" fi elif [ "${exitcode}" != "0" ]; then - fn_print_error2_nl "${commandaction} server: ${remotelocation}: Exit code: ${exitcode}" - fn_script_log_error "${commandaction} server: ${remotelocation}: Exit code: ${exitcode}" + fn_print_error2_nl "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}" + fn_script_log_error "${commandaction} ${selfname}: ${remotelocation}: Exit code: ${exitcode}" else - fn_print_complete_nl "${commandaction} server: ${remotelocation}" - fn_script_log_pass "${commandaction} server: ${remotelocation}" + fn_print_complete_nl "${commandaction} ${selfname}: ${remotelocation}" + fn_script_log_pass "${commandaction} ${selfname}: ${remotelocation}" fi if [ "${counter}" -gt "10" ]; then - fn_print_failure_nl "${commandaction} server: ${remotelocation}: Did not complete the download, too many retrys" - fn_script_log_fatal "${commandaction} server: ${remotelocation}: Did not complete the download, too many retrys" + fn_print_failure_nl "${commandaction} ${selfname}: ${remotelocation}: Did not complete the download, too many retrys" + fn_script_log_fatal "${commandaction} ${selfname}: ${remotelocation}: Did not complete the download, too many retrys" core_exit.sh fi done diff --git a/lgsm/functions/core_getopt.sh b/lgsm/functions/core_getopt.sh index fe31f488f2..bca60d5d9c 100644 --- a/lgsm/functions/core_getopt.sh +++ b/lgsm/functions/core_getopt.sh @@ -36,8 +36,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=( "wi;wipe" "command_wipe.sh" "Wipe your main game server data." ) -cmd_wipeall=( "wa;wipeall" "wipeall=1; command_wipe.sh" "Wipe your game server data and blueprints." ) +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_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." ) @@ -94,7 +94,7 @@ fi # Unreal exclusive. if [ "${shortname}" == "rust" ]; then - currentopt+=( "${cmd_wipe[@]}" "${cmd_wipeall[@]}" ) + currentopt+=( "${cmd_wipe[@]}" "${cmd_full_wipe[@]}" ) fi if [ "${engine}" == "unreal2" ]; then if [ "${shortname}" == "ut2k4" ]; then From bb01afafc8b3e8e2ae2275a65ad498e72c8ce165 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Tue, 21 Jul 2020 12:13:02 +0100 Subject: [PATCH 2/2] Release v20.4.1 --- lgsm/functions/core_functions.sh | 2 +- linuxgsm.sh | 2 +- tests/tests_fctrserver.sh | 2 +- tests/tests_jc2server.sh | 2 +- tests/tests_mcserver.sh | 2 +- tests/tests_ts3server.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index c0be8d8cc8..08b21f8c0e 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -7,7 +7,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -modulesversion="v20.4.0" +modulesversion="v20.4.1" # Core diff --git a/linuxgsm.sh b/linuxgsm.sh index 7f588937bb..dc197210db 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.4.0" +version="v20.4.1" shortname="core" gameservername="core" commandname="CORE" diff --git a/tests/tests_fctrserver.sh b/tests/tests_fctrserver.sh index 4bdbd5c48a..6510c82b5b 100644 --- a/tests/tests_fctrserver.sh +++ b/tests/tests_fctrserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.4.0" +version="v20.4.1" shortname="fctr" gameservername="fctrserver" commandname="CORE" diff --git a/tests/tests_jc2server.sh b/tests/tests_jc2server.sh index dced37f748..e546b74e9f 100644 --- a/tests/tests_jc2server.sh +++ b/tests/tests_jc2server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.4.0" +version="v20.4.1" shortname="jc2" gameservername="jc2server" commandname="CORE" diff --git a/tests/tests_mcserver.sh b/tests/tests_mcserver.sh index 4837c45942..8c52e05e4f 100644 --- a/tests/tests_mcserver.sh +++ b/tests/tests_mcserver.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.4.0" +version="v20.4.1" shortname="mc" gameservername="mcserver" commandname="CORE" diff --git a/tests/tests_ts3server.sh b/tests/tests_ts3server.sh index b4d0a4563b..8a6d38e18d 100644 --- a/tests/tests_ts3server.sh +++ b/tests/tests_ts3server.sh @@ -20,7 +20,7 @@ if [ -f ".dev-debug" ]; then set -x fi -version="v20.4.0" +version="v20.4.1" shortname="ts3" gameservername="ts3server" commandname="CORE"