Skip to content

Commit 836c66d

Browse files
committed
feat(etl): improve local build detection
Updates the game log directory to the "legacy" folder and enhances local build detection by parsing etconsole.log for version information, falling back to build.txt if necessary.
1 parent 716e948 commit 836c66d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lgsm/config-default/config-lgsm/etlserver/_default.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ backupdir="${lgsmdir}/backup"
160160

161161
## Logging Directories
162162
[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || logdir="${rootdir}/log"
163-
gamelogdir="${serverfiles}/Logs"
163+
gamelogdir="${serverfiles}/legacy"
164164
lgsmlogdir="${logdir}/script"
165165
consolelogdir="${logdir}/console"
166166
lgsmlog="${lgsmlogdir}/${selfname}-script.log"

lgsm/modules/update_etl.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ fn_update_dl() {
1818
fn_update_localbuild() {
1919
# Gets local build info.
2020
fn_print_dots "Checking local build: ${remotelocation}"
21-
# Uses build file to get local build.
22-
localbuild=$(head -n 1 "${serverfiles}/build.txt" 2> /dev/null)
21+
# Try to get build version from etconsole.log.
22+
if [ -f "${serverfiles}/legacy/etconsole.log" ]; then
23+
localbuild=$(grep "Initializing legacy game" "${serverfiles}/legacy/etconsole.log" | sed -n 's/.*\^2\(v[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p' | tail -1)
24+
fi
25+
# Fall back to build.txt if log parse failed or log does not exist.
26+
if [ -z "${localbuild}" ]; then
27+
localbuild=$(head -n 1 "${serverfiles}/build.txt" 2> /dev/null)
28+
fi
2329
if [ -z "${localbuild}" ]; then
2430
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
2531
fn_script_log_error "Missing local build info"

0 commit comments

Comments
 (0)