Resolved Game-Primary.ini writing errors
This commit is contained in:
parent
e29004869a
commit
9cfa799a60
@ -165,7 +165,7 @@ kill_server() {
|
|||||||
case ${1} in
|
case ${1} in
|
||||||
-h | -\? | --help)
|
-h | -\? | --help)
|
||||||
printf "Usage: %s\n" \
|
printf "Usage: %s\n" \
|
||||||
"kill --server <server id: int> | kill -s <server id: int>
|
"kill [options]
|
||||||
--server <server id: int> | -s <server id: int>
|
--server <server id: int> | -s <server id: int>
|
||||||
Kills the server with the given id
|
Kills the server with the given id
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ 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
|
cat <<__EOF__ >"${CONFIG_DIRECTORY}"/readme.txt
|
||||||
Some notes about the configuration within this directory:
|
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.
|
All configs (server.pass, rcon.pass, etc.) write to each server's Game-Primary.ini when invoked.
|
||||||
@ -415,7 +415,7 @@ configure() {
|
|||||||
|
|
||||||
[[ ! -f "${primary_server_config}" ]] &&
|
[[ ! -f "${primary_server_config}" ]] &&
|
||||||
log "error" "Unable to find a config for $(important "Server-${server_num}") (${primary_server_config})" &&
|
log "error" "Unable to find a config for $(important "Server-${server_num}") (${primary_server_config})" &&
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if [[ "${verbose}" -eq 1 ]]; then
|
if [[ "${verbose}" -eq 1 ]]; then
|
||||||
echo ""
|
echo ""
|
||||||
@ -442,12 +442,13 @@ start() {
|
|||||||
case ${1} in
|
case ${1} in
|
||||||
-h | -\? | --help)
|
-h | -\? | --help)
|
||||||
printf "Usage: %s\n" \
|
printf "Usage: %s\n" \
|
||||||
"start --server <server id: int> | kill -s <server id: int>
|
"start [options]
|
||||||
--server <server id: int> | -s <server id: int>
|
--server <server id: int> | -s <server id: int>
|
||||||
Starts the given server id
|
Starts the given server id
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
--server 3
|
--server 3
|
||||||
|
|
||||||
--can-kill | -c
|
--can-kill | -c
|
||||||
Automatically kills the server if it is running without prompting
|
Automatically kills the server if it is running without prompting
|
||||||
|
|
||||||
@ -568,10 +569,12 @@ start() {
|
|||||||
# 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
|
||||||
local loading_primary_config
|
local loading_primary_config
|
||||||
|
local removing_old_primary_config
|
||||||
local loaded_primary_config
|
local loaded_primary_config
|
||||||
|
|
||||||
loading_primary_config=0
|
loading_primary_config=0
|
||||||
loaded_primary_config=0
|
loaded_primary_config=0
|
||||||
|
removing_old_primary_config=0
|
||||||
primary_config_admins_mods="$(
|
primary_config_admins_mods="$(
|
||||||
cat <<__EOF__
|
cat <<__EOF__
|
||||||
# BEGIN PRIMARY CONFIG - DO NOT INCLUDE SERVER SPECIFIC CONFIGURATION BETWEEN THIS LINE AND "END PRIMARY CONFIG"
|
# BEGIN PRIMARY CONFIG - DO NOT INCLUDE SERVER SPECIFIC CONFIGURATION BETWEEN THIS LINE AND "END PRIMARY CONFIG"
|
||||||
@ -587,27 +590,40 @@ __EOF__
|
|||||||
log "info" "Overwriting Game.ini..."
|
log "info" "Overwriting Game.ini..."
|
||||||
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ "${line}" == "RconPort="* ]] && [ "${updated_rcon_port}" -eq 0 ]; then
|
if [[ "${line}" == "RconPort="* ]] && [[ "${updated_rcon_port}" -eq 0 ]]; then
|
||||||
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
|
||||||
[[ -n "${rcon_pass}" ]] && \
|
[[ -n "${rcon_pass}" ]] &&
|
||||||
echo "RconPassword=${rcon_pass}"
|
echo "RconPassword=${rcon_pass}"
|
||||||
updated_rcon_pass=1
|
updated_rcon_pass=1
|
||||||
elif [[ "${line}" == "ServerPassword="* ]] && [ "${updated_server_pass}" -eq 0 ]; then
|
elif [[ "${line}" == "ServerPassword="* ]] && [[ "${updated_server_pass}" -eq 0 ]]; then
|
||||||
[[ -n "${server_pass}" ]] && \
|
[[ -n "${server_pass}" ]] &&
|
||||||
echo "ServerPassword=${server_pass}"
|
echo "ServerPassword=${server_pass}"
|
||||||
updated_server_pass=1
|
updated_server_pass=1
|
||||||
elif [[ "${line}" == *"BEGIN PRIMARY CONFIG"* ]]; then
|
elif [[ "${line}" == *"Mordhau.MordhauGameSession"* ]]; then
|
||||||
loading_primary_config=1
|
loading_primary_config=1
|
||||||
elif [[ "${line}" == *"END PRIMARY CONFIG"* ]]; then
|
echo "${line}"
|
||||||
loading_primary_config=0
|
elif [[ "${loading_primary_config}" -eq 1 ]]; then
|
||||||
echo "${primary_config_admins_mods}"
|
if [[ "${line}" == *"["* ]]; then
|
||||||
loaded_primary_config=1
|
echo "${primary_config_admins_mods}"
|
||||||
elif [ "${loading_primary_config}" -eq 0 ]; then
|
loading_primary_config=0
|
||||||
|
loaded_primary_config=1
|
||||||
|
echo ""
|
||||||
|
echo "${line}"
|
||||||
|
else
|
||||||
|
if [[ "${line}" == *"BEGIN PRIMARY CONFIG"* ]]; then
|
||||||
|
removing_old_primary_config=1
|
||||||
|
elif [[ "${line}" == *"END PRIMARY CONFIG"* ]]; then
|
||||||
|
removing_old_primary_config=0
|
||||||
|
elif [[ "${removing_old_primary_config}" -eq 0 ]]; then
|
||||||
|
echo "${line}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
echo "${line}"
|
echo "${line}"
|
||||||
fi
|
fi
|
||||||
done <"${game_primary}" >"serv.temp"
|
done < "${game_primary}" >"serv.temp"
|
||||||
|
|
||||||
if [ "${loaded_primary_config}" -eq 0 ]; then
|
if [ "${loaded_primary_config}" -eq 0 ]; then
|
||||||
log "info" "Primary config not injected, loading it now..."
|
log "info" "Primary config not injected, loading it now..."
|
||||||
@ -654,14 +670,18 @@ update() {
|
|||||||
case ${1} in
|
case ${1} in
|
||||||
-h | -\? | --help)
|
-h | -\? | --help)
|
||||||
printf "Usage: %s\n" \
|
printf "Usage: %s\n" \
|
||||||
"update --server <server id: int> | kill -s <server id: int>
|
"update [options]
|
||||||
--server <server id: int> | -s <server id: int>
|
--server <server id: int> | -s <server id: int>
|
||||||
Starts the given server id
|
Starts the given server id
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
--server 3
|
--server 3
|
||||||
--redownload-mods | -r
|
|
||||||
Redownloads all mods by clearing the .modio folder"
|
--redownload-mods | -r
|
||||||
|
Redownloads all mods by clearing the .modio folder
|
||||||
|
|
||||||
|
Example:
|
||||||
|
--redownload-mods"
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
--) # End of all options.
|
--) # End of all options.
|
||||||
@ -702,10 +722,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" ]] \
|
[[ ! -f "${server_directory}/Mordhau/Saved/Config/LinuxServer/Game-Primary.ini" ]] &&
|
||||||
&& log "info" "Generating a Game-Primary.ini as it did not exist" \
|
log "info" "Generating a Game-Primary.ini as it did not exist" &&
|
||||||
&& cat "${server_config}" > "${server_directory}/Mordhau/Saved/Config/LinuxServer/Game-Primary.ini" \
|
cat "${server_config}" >"${server_directory}/Mordhau/Saved/Config/LinuxServer/Game-Primary.ini" &&
|
||||||
&& log "info" "Game-Primary.ini created"
|
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}")"
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -719,7 +739,7 @@ install() {
|
|||||||
case ${1} in
|
case ${1} in
|
||||||
-h | -\? | --help)
|
-h | -\? | --help)
|
||||||
printf "Usage: %s\n" \
|
printf "Usage: %s\n" \
|
||||||
"install --server <server id: int> | install -s <server id: int>
|
"install [options]
|
||||||
--server <server id: int> | -s <server id: int>
|
--server <server id: int> | -s <server id: int>
|
||||||
Installs the server to the given id if it doesn't exist
|
Installs the server to the given id if it doesn't exist
|
||||||
|
|
||||||
@ -769,8 +789,8 @@ install() {
|
|||||||
|
|
||||||
run_and_stop "${server_id}"
|
run_and_stop "${server_id}"
|
||||||
|
|
||||||
cat "${server_config}" > "${server_directory}/Mordhau/Saved/Config/LinuxServer/Game-Primary.ini" \
|
cat "${server_config}" >"${server_directory}/Mordhau/Saved/Config/LinuxServer/Game-Primary.ini" &&
|
||||||
&& log "info" "Created the Game-Primary.ini file"
|
log "info" "Created the Game-Primary.ini file"
|
||||||
|
|
||||||
log "info" "Finished setting up Server-${server_id}"
|
log "info" "Finished setting up Server-${server_id}"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user