Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rustserver): fix blueprint not being wiped #2972

Merged
merged 28 commits into from Jul 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 7 additions & 25 deletions lgsm/config-default/config-lgsm/rustserver/_default.cfg
Expand Up @@ -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 ####
Expand Down
7 changes: 2 additions & 5 deletions lgsm/functions/check_config.sh
Expand Up @@ -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
28 changes: 15 additions & 13 deletions lgsm/functions/command_wipe.sh
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
38 changes: 19 additions & 19 deletions lgsm/functions/core_dl.sh
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lgsm/functions/core_getopt.sh
Expand Up @@ -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." )
Expand Down Expand Up @@ -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
Expand Down