Jelajahi Sumber

fix(ut99): keep config and logs in serverfiles with -nohomedir (#5133)

The OldUnreal 469 patch uses ~/.utpg as a per-user directory on Linux
unless started with -nohomedir. Any ini the engine creates or saves
(mutator configs such as ACE or map vote, User.ini) was written to
~/.utpg/System instead of serverfiles/System, and ucc.log and the
per-match ngLog files went to ~/.utpg, where LinuxGSM never rotated them.

Start UT99 with -nohomedir, as ut2k4 and ut3 already do. A new pre-start
fix_ut99.sh moves any ini left in ~/.utpg/System into the System
directory so existing servers keep their settings. Those files were the
copies the server was reading, since 469 looks in the home directory
first; a stock file they replace is kept as a numbered backup.

Co-authored-by: dgibbs64 <dgibbs64@users.noreply.github.com>
Daniel Gibbs 2 hari lalu
induk
melakukan
8f1e3ed213

+ 1 - 1
lgsm/config-default/config-lgsm/ut99server/_default.cfg

@@ -13,7 +13,7 @@ defaultmap="DM-Deck16]["
 ip="0.0.0.0"
 
 ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
-startparameters="server ${defaultmap}.unr ini=${servercfgfullpath}"
+startparameters="server ${defaultmap}.unr ini=${servercfgfullpath} -nohomedir"
 
 ## Extra Parameters | https://docs.linuxgsm.com/configuration/start-parameters#extra-parameters
 # Added to the end of startparameters.

+ 5 - 0
lgsm/modules/core_modules.sh

@@ -603,6 +603,11 @@ fix_ut3.sh() {
 	fn_fetch_module
 }
 
+fix_ut99.sh() {
+	modulefile="${FUNCNAME[0]}"
+	fn_fetch_module
+}
+
 fix_vh.sh() {
 	modulefile="${FUNCNAME[0]}"
 	fn_fetch_module

+ 1 - 1
lgsm/modules/fix.sh

@@ -53,7 +53,7 @@ fn_apply_fix() {
 	fi
 }
 
-apply_pre_start_fix=(arma3 armar ark av bf1942 bfv bt bo csgo cmw cod cod2 coduo codwaw ct dst hw ins ios kf nd nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts ts3 mcb mohaa mta unt ut vh vs wurm xnt zmr)
+apply_pre_start_fix=(arma3 armar ark av bf1942 bfv bt bo csgo cmw cod cod2 coduo codwaw ct dst hw ins ios kf nd nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts ts3 mcb mohaa mta unt ut ut99 vh vs wurm xnt zmr)
 apply_post_install_fix=(av kf kf2 nd ro ut2k4 ut3)
 
 # validate registered fixes for safe development

+ 18 - 0
lgsm/modules/fix_ut99.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+# LinuxGSM fix_ut99.sh module
+# Author: Daniel Gibbs
+# Contributors: https://linuxgsm.com/contrib
+# Website: https://linuxgsm.com
+# Description: Resolves issues with Unreal Tournament 99.
+
+moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
+
+if [[ "${startparameters}" == *"-nohomedir"* ]] && [ -d "${HOME}/.utpg/System" ]; then
+	while IFS= read -r -d '' homeini; do
+		fixname="move $(basename "${homeini}") from ${HOME}/.utpg/System to ${systemdir}"
+		fn_fix_msg_start
+		mv --backup=numbered "${homeini}" "${systemdir}/"
+		exitcode=$?
+		fn_fix_msg_end
+	done < <(find "${HOME}/.utpg/System" -maxdepth 1 -type f -name "*.ini" -print0)
+fi