From 2de9757882e50ef98beb2458dfde4686164b9e70 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 30 Oct 2026 09:34:15 +0000 Subject: [PATCH 1/4] fix(update): force download of update archives Ten update modules passed "force" to fn_fetch_file, which only recognises "forcedl", so an archive already in tmpdir was reused. A failed extraction leaves the archive in tmpdir, and for fixed file names such as multitheftauto_linux_x64.tar.gz the next update would extract the stale file again. --- lgsm/modules/update_bb.sh | 2 +- lgsm/modules/update_etl.sh | 2 +- lgsm/modules/update_fctr.sh | 2 +- lgsm/modules/update_jk2.sh | 2 +- lgsm/modules/update_mta.sh | 2 +- lgsm/modules/update_pmc.sh | 2 +- lgsm/modules/update_ts3.sh | 2 +- lgsm/modules/update_ut99.sh | 2 +- lgsm/modules/update_vints.sh | 2 +- lgsm/modules/update_xnt.sh | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lgsm/modules/update_bb.sh b/lgsm/modules/update_bb.sh index aeb47fe448..51b3f76d33 100755 --- a/lgsm/modules/update_bb.sh +++ b/lgsm/modules/update_bb.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "${remotebuildhash}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" echo "${remotebuild}" > "${serverfiles}/build.txt" fn_clear_tmp diff --git a/lgsm/modules/update_etl.sh b/lgsm/modules/update_etl.sh index fa3f9f591f..e44c058f8d 100755 --- a/lgsm/modules/update_etl.sh +++ b/lgsm/modules/update_etl.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "${remotebuildhash}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" echo "${remotebuild}" > "${serverfiles}/build.txt" fn_clear_tmp diff --git a/lgsm/modules/update_fctr.sh b/lgsm/modules/update_fctr.sh index d82f53881f..8b065738ea 100755 --- a/lgsm/modules/update_fctr.sh +++ b/lgsm/modules/update_fctr.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "nohash" fn_dl_extract "${tmpdir}" "factorio_headless_${factorioarch}-${remotebuild}.tar.xz" "${serverfiles}" "factorio" fn_clear_tmp } diff --git a/lgsm/modules/update_jk2.sh b/lgsm/modules/update_jk2.sh index 1d2ba36458..930f5ea98d 100755 --- a/lgsm/modules/update_jk2.sh +++ b/lgsm/modules/update_jk2.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "nohash" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}/GameData" "linux-amd64" fn_clear_tmp } diff --git a/lgsm/modules/update_mta.sh b/lgsm/modules/update_mta.sh index 5adbc57ed7..353dca9d07 100755 --- a/lgsm/modules/update_mta.sh +++ b/lgsm/modules/update_mta.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to tmpdir. - fn_fetch_file "https://linux.multitheftauto.com/dl/multitheftauto_linux_x64.tar.gz" "" "" "" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "nochmodx" "norun" "force" "nohash" + fn_fetch_file "https://linux.multitheftauto.com/dl/multitheftauto_linux_x64.tar.gz" "" "" "" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "nochmodx" "norun" "forcedl" "nohash" fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "${serverfiles}" "multitheftauto_linux_x64" fn_clear_tmp } diff --git a/lgsm/modules/update_pmc.sh b/lgsm/modules/update_pmc.sh index 907e32dbe0..a5185e6929 100755 --- a/lgsm/modules/update_pmc.sh +++ b/lgsm/modules/update_pmc.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "force" "${remotebuildhash}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "forcedl" "${remotebuildhash}" cp -f "${tmpdir}/${remotebuildfilename}" "${serverfiles}/${executable#./}" echo "${remotebuild}" > "${serverfiles}/build.txt" fn_clear_tmp diff --git a/lgsm/modules/update_ts3.sh b/lgsm/modules/update_ts3.sh index 58ad872b25..92136ed5d4 100755 --- a/lgsm/modules/update_ts3.sh +++ b/lgsm/modules/update_ts3.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "${remotebuildhash}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" "teamspeak3-server_linux_${ts3arch}" fn_clear_tmp } diff --git a/lgsm/modules/update_ut99.sh b/lgsm/modules/update_ut99.sh index f21117125b..ce8158d05f 100755 --- a/lgsm/modules/update_ut99.sh +++ b/lgsm/modules/update_ut99.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "nohash" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "nohash" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" echo "${remotebuild}" > "${serverfiles}/build.txt" fn_clear_tmp diff --git a/lgsm/modules/update_vints.sh b/lgsm/modules/update_vints.sh index 0925e6f801..6f2da81ebd 100755 --- a/lgsm/modules/update_vints.sh +++ b/lgsm/modules/update_vints.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "${remotebuildhash}" rm -rf "${serverfiles:?}/assets" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" fn_clear_tmp diff --git a/lgsm/modules/update_xnt.sh b/lgsm/modules/update_xnt.sh index 831f63325e..751709e8bf 100755 --- a/lgsm/modules/update_xnt.sh +++ b/lgsm/modules/update_xnt.sh @@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_update_dl() { # Download and extract files to serverfiles. - fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "force" "${remotebuildhash}" + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "nochmodx" "norun" "forcedl" "${remotebuildhash}" fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" "Xonotic" fn_clear_tmp } From 86c89ff3d2ed9f18e45d68772e66899d061c1aa9 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 30 Oct 2026 09:34:16 +0000 Subject: [PATCH 2/4] fix(install): exit non-zero when log directories cannot be created install_logs.sh called core_exit.sh without setting exitcode, so a failure to create a log directory, log file or symlink printed FAIL but exited with code 0. Log each failure with fn_script_log_fail, which sets exitcode to 1. --- lgsm/modules/install_logs.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lgsm/modules/install_logs.sh b/lgsm/modules/install_logs.sh index 9e1b89dbdf..987e7e8937 100755 --- a/lgsm/modules/install_logs.sh +++ b/lgsm/modules/install_logs.sh @@ -17,6 +17,7 @@ echo -en "creating log directory [ ${italic}${logdir}${default} ]" if [ ! -d "${logdir}" ]; then if ! mkdir -p "${logdir}"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating log directory ${logdir}" core_exit.sh else fn_print_ok_eol_nl @@ -29,6 +30,7 @@ echo -en "creating script log directory [ ${italic}${lgsmlogdir}${default} ]" if [ ! -d "${lgsmlogdir}" ]; then if ! mkdir -p "${lgsmlogdir}"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating script log directory ${lgsmlogdir}" core_exit.sh else fn_print_ok_eol_nl @@ -41,6 +43,7 @@ echo -en "creating script log [ ${italic}${lgsmlog}${default} ]" if [ ! -f "${lgsmlog}" ]; then if ! touch "${lgsmlog}"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating script log ${lgsmlog}" core_exit.sh else fn_print_ok_eol_nl @@ -53,6 +56,7 @@ echo -en "creating console log directory [ ${italic}${consolelogdir}${default} ] if [ ! -d "${consolelogdir}" ]; then if ! mkdir -p "${consolelogdir}"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating console log directory ${consolelogdir}" core_exit.sh else fn_print_ok_eol_nl @@ -65,6 +69,7 @@ echo -en "creating console log [ ${italic}${consolelog}${default} ]" if [ ! -f "${consolelog}" ]; then if ! touch "${consolelog}"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating console log ${consolelog}" core_exit.sh else fn_print_ok_eol_nl @@ -78,6 +83,7 @@ if [ -n "${gamelogdir}" ]; then if [ ! -d "${gamelogdir}" ]; then if ! mkdir -p "${gamelogdir}"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating game log directory ${gamelogdir}" core_exit.sh else fn_print_ok_eol_nl @@ -97,6 +103,7 @@ if [ -n "${gamelogdir}" ] && [ "${gamelogdir:0:${#logdir}}" != "${logdir}" ]; th if [ ! -h "${logdir}/server" ] || [ "$(readlink -f "${logdir}/server")" != "${gamelogdir}" ]; then if ! ln -nfs "${gamelogdir}" "${logdir}/server"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating symlink to game log directory ${logdir}/server" core_exit.sh else fn_print_ok_eol_nl @@ -112,6 +119,7 @@ if [ -d "${HOME}/.steam/steam/logs" ]; then if [ ! -L "${logdir}/steam" ]; then if ! ln -nfs "${HOME}/.steam/steam/logs" "${logdir}/steam"; then fn_print_fail_eol_nl + fn_script_log_fail "Creating symlink to steam log directory ${logdir}/steam" core_exit.sh else fn_print_ok_eol_nl From 713e6a0abd3ae71dcbd20b1a958163cad39f4c9d Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 30 Oct 2026 09:34:17 +0000 Subject: [PATCH 3/4] fix(mta): exit cleanly after install-default-resources The module never called core_exit.sh, so running ./mtaserver install-default-resources always ended with "Command did not exit correctly" and exit code 2, even on success. Exit only when it is the first command, so the install flow that calls it carries on. --- lgsm/modules/command_install_resources_mta.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lgsm/modules/command_install_resources_mta.sh b/lgsm/modules/command_install_resources_mta.sh index 7b1c45d12d..72084f77ae 100755 --- a/lgsm/modules/command_install_resources_mta.sh +++ b/lgsm/modules/command_install_resources_mta.sh @@ -30,3 +30,8 @@ else fn_print_warning_nl "Default resources are not installed when using ./${selfname} auto-install." fn_print_information_nl "To install default resources use ./${selfname} install" fi + +if [ "${firstcommandname}" == "DEFAULT-RESOURCES" ]; then + exitcode=0 + core_exit.sh +fi From b3227d03115d62bbdcaef6703a020312f47dfb83 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Fri, 30 Oct 2026 09:40:54 +0000 Subject: [PATCH 4/4] fix(core): stop SteamCMD install when extraction fails under exitbypass When exitbypass is set, core_exit.sh returns instead of exiting, so a failed extraction fell through to the caller. fn_install_steamcmd then ran chmod on a steamcmd.sh that was never extracted. This is reachable when an update restarts the server and check_steamcmd.sh installs SteamCMD. fn_dl_extract now returns 1 after a bypassed failure, and fn_install_steamcmd stops on it. --- lgsm/modules/core_dl.sh | 2 ++ lgsm/modules/core_steamcmd.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lgsm/modules/core_dl.sh b/lgsm/modules/core_dl.sh index 7da65094eb..f63cc7ba0a 100755 --- a/lgsm/modules/core_dl.sh +++ b/lgsm/modules/core_dl.sh @@ -314,6 +314,7 @@ fn_dl_extract() { fn_script_log_fail "Extracting ${local_filename}" fn_script_log_fail "File ${local_filedir}/${local_filename} not found" core_exit.sh + return 1 fi mime=$(file -b --mime-type "${local_filedir}/${local_filename}") if [ "${mime}" == "application/gzip" ] || [ "${mime}" == "application/x-gzip" ]; then @@ -353,6 +354,7 @@ fn_dl_extract() { fi echo -e "${extractcmd}" core_exit.sh + return 1 else fn_print_ok_eol_nl fn_script_log_pass "Extracting ${local_filename}" diff --git a/lgsm/modules/core_steamcmd.sh b/lgsm/modules/core_steamcmd.sh index 81b8d0cc23..d8043ed269 100755 --- a/lgsm/modules/core_steamcmd.sh +++ b/lgsm/modules/core_steamcmd.sh @@ -15,7 +15,7 @@ fn_install_steamcmd() { mkdir -p "${steamcmddir}" fi fn_fetch_file "https://media.steampowered.com/client/steamcmd_linux.tar.gz" "" "" "" "${tmpdir}" "steamcmd_linux.tar.gz" "nochmodx" "norun" "noforce" "nohash" - fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" + fn_dl_extract "${tmpdir}" "steamcmd_linux.tar.gz" "${steamcmddir}" || return 1 chmod +x "${steamcmddir}/steamcmd.sh" }