Added server password support and a note on configs
This commit is contained in:
parent
3c8c992efa
commit
75c947401f
@ -259,6 +259,16 @@ generate_default_configs() {
|
|||||||
|
|
||||||
mkdir -p "${BASE_DIR}" && log "info" "Created base directory if it didn't exist"
|
mkdir -p "${BASE_DIR}" && log "info" "Created base directory if it didn't exist"
|
||||||
mkdir -p "${CONFIG_DIRECTORY}" && log "info" "Created config directory if it didn't exist"
|
mkdir -p "${CONFIG_DIRECTORY}" && log "info" "Created config directory if it didn't exist"
|
||||||
|
|
||||||
|
cat << __EOF__ > "${CONFIG_DIRECTORY}"/readme.txt
|
||||||
|
Some notes about the configuration within this directory:
|
||||||
|
|
||||||
|
All configs (server.pass, rcon.pass, etc.) write to each server's Game-Primary.ini when invoked.
|
||||||
|
|
||||||
|
A note on "server.pass" --
|
||||||
|
If this file is empty then the server password will not be overwritten, this means that you can use per server
|
||||||
|
passwords instead.
|
||||||
|
__EOF__
|
||||||
|
|
||||||
if [ ! -f "${RCON_PASS_LOCATION}" ]; then
|
if [ ! -f "${RCON_PASS_LOCATION}" ]; then
|
||||||
local rcon_pass
|
local rcon_pass
|
||||||
@ -549,9 +559,11 @@ start() {
|
|||||||
# The below booleans are used to avoid duplicating lines, a sort of failsafe
|
# The below booleans are used to avoid duplicating lines, a sort of failsafe
|
||||||
local updated_rcon_port
|
local updated_rcon_port
|
||||||
local updated_rcon_pass
|
local updated_rcon_pass
|
||||||
|
local updated_server_pass
|
||||||
|
|
||||||
updated_rcon_port=0
|
updated_rcon_port=0
|
||||||
updated_rcon_pass=0
|
updated_rcon_pass=0
|
||||||
|
updated_server_pass=0
|
||||||
|
|
||||||
# Loading primary config bool is incredibly important as it controls loading the external configurations to the server
|
# Loading primary config bool is incredibly important as it controls loading the external configurations to the server
|
||||||
local primary_config_admins_mods
|
local primary_config_admins_mods
|
||||||
@ -579,8 +591,13 @@ __EOF__
|
|||||||
echo "RconPort=${rcon_port}"
|
echo "RconPort=${rcon_port}"
|
||||||
updated_rcon_port=1
|
updated_rcon_port=1
|
||||||
elif [[ "${line}" == "RconPassword="* ]] && [ "${updated_rcon_pass}" -eq 0 ]; then
|
elif [[ "${line}" == "RconPassword="* ]] && [ "${updated_rcon_pass}" -eq 0 ]; then
|
||||||
echo "RconPassword=${rcon_pass}"
|
[[ -n "${rcon_pass}" ]] && \
|
||||||
|
echo "RconPassword=${rcon_pass}"
|
||||||
updated_rcon_pass=1
|
updated_rcon_pass=1
|
||||||
|
elif [[ "${line}" == "ServerPassword="* ]] && [ "${updated_server_pass}" -eq 0 ]; then
|
||||||
|
[[ -n "${server_pass}" ]] && \
|
||||||
|
echo "ServerPassword=${server_pass}"
|
||||||
|
updated_server_pass=1
|
||||||
elif [[ "${line}" == *"BEGIN PRIMARY CONFIG"* ]]; then
|
elif [[ "${line}" == *"BEGIN PRIMARY CONFIG"* ]]; then
|
||||||
loading_primary_config=1
|
loading_primary_config=1
|
||||||
elif [[ "${line}" == *"END PRIMARY CONFIG"* ]]; then
|
elif [[ "${line}" == *"END PRIMARY CONFIG"* ]]; then
|
||||||
@ -685,6 +702,10 @@ update() {
|
|||||||
log "info" "Verifying and updating server"
|
log "info" "Verifying and updating server"
|
||||||
steamcmd +login anonymous +force_install_dir "${server_directory}" +app_update 629800 validate +quit
|
steamcmd +login anonymous +force_install_dir "${server_directory}" +app_update 629800 validate +quit
|
||||||
run_and_stop "${server_id}"
|
run_and_stop "${server_id}"
|
||||||
|
[[ ! -f "${server_directory}/Mordhau/Saved/Config/LinuxServer/Game-Primary.ini" ]] \
|
||||||
|
&& log "info" "Generating a Game-Primary.ini as it did not exist" \
|
||||||
|
&& cat "${server_config}" > "${server_directory}/Mordhau/Saved/Config/LinuxServer/Game-Primary.ini" \
|
||||||
|
&& log "info" "Game-Primary.ini created"
|
||||||
log "info" "Successfully verified and updated $(important "Server-${server_id}")"
|
log "info" "Successfully verified and updated $(important "Server-${server_id}")"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user