Skip to content

Commit 9326d48

Browse files
authored
fix(mta): change updater to use builds (#4310)
multitheftauto/mtasa-blue#3176
1 parent 6921851 commit 9326d48

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

lgsm/modules/update_mc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fn_update_dl() {
1111
# Download and extract files to serverfiles.
1212
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "noforce" "nohash"
1313
cp -f "${tmpdir}/${remotebuildfilename}" "${serverfiles}/${executable#./}"
14+
fn_clear_tmp
1415
}
1516

1617
fn_update_localbuild() {

lgsm/modules/update_mcb.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ fn_update_dl() {
2323
echo -e "${extractcmd}" >> "${lgsmlog}"
2424
fi
2525
echo -e "${extractcmd}"
26+
fn_clear_tmp
2627
core_exit.sh
2728
else
2829
fn_print_ok_eol_nl
2930
fn_script_log_pass "Extracting ${local_filename}"
31+
fn_clear_tmp
3032
fi
3133
}
3234

lgsm/modules/update_mta.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ fn_update_dl() {
1111
# Download and extract files to tmpdir.
1212
fn_fetch_file "http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz" "" "" "" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "nochmodx" "norun" "force" "nohash"
1313
fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "${serverfiles}" "multitheftauto_linux_x64"
14+
fn_clear_tmp
1415
}
1516

1617
fn_update_localbuild() {
1718
# Gets local build info.
1819
fn_print_dots "Checking local build: ${remotelocation}"
19-
# Uses log file to get local build.
20-
localbuild=$(grep "= Multi Theft Auto: San Andreas v" "${serverfiles}/mods/deathmatch/logs/server.log" | awk '{ print $7 }' | sed -r 's/^.{1}//' | tail -1)
20+
# Uses executable to get local build.
21+
if [ -d "${executabledir}" ]; then
22+
cd "${executabledir}" || exit
23+
localbuild=$(${executable} -v 2> /dev/null)
24+
fi
2125
if [ -z "${localbuild}" ]; then
2226
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
2327
fn_script_log_error "Missing local build info"
@@ -31,11 +35,11 @@ fn_update_localbuild() {
3135

3236
fn_update_remotebuild() {
3337
# Get remote build info.
34-
apiurl="https://api.github.com/repos/multitheftauto/mtasa-blue/releases/latest"
38+
apiurl="https://linux.multitheftauto.com/revision/latest.txt"
3539
remotebuildresponse=$(curl -s "${apiurl}")
36-
remotebuildfilename=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .name')
37-
remotebuildurl=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .browser_download_url')
38-
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '.tag_name')
40+
remotebuildfilename="multitheftauto_linux_x64.tar.gz"
41+
remotebuildurl="http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz"
42+
remotebuildversion=$(echo "${remotebuildresponse}")
3943
if [ "${firstcommandname}" != "INSTALL" ]; then
4044
fn_print_dots "Checking remote build: ${remotelocation}"
4145
# Checks if remotebuildversion variable has been set.

lgsm/modules/update_pmc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fn_update_dl() {
1212
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "force" "${remotebuildhash}"
1313
cp -f "${tmpdir}/${remotebuildfilename}" "${serverfiles}/${executable#./}"
1414
echo "${remotebuildversion}" > "${serverfiles}/build.txt"
15+
fn_clear_tmp
1516
}
1617

1718
fn_update_localbuild() {

lgsm/modules/update_vints.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn_update_localbuild() {
2020
# Uses executable to get local build.
2121
if [ -d "${executabledir}" ]; then
2222
cd "${executabledir}" || exit
23-
localbuild="$(${preexecutable} ${executable} --version | sed '/^[[:space:]]*$/d')"
23+
localbuild="$(${preexecutable} ${executable} --version 2> /dev/null | sed '/^[[:space:]]*$/d')"
2424
fi
2525
if [ -z "${localbuild}" ]; then
2626
fn_print_error "Checking local build: ${remotelocation}: missing local build info"

0 commit comments

Comments
 (0)