mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2025-01-07 03:26:50 +08:00
fix(mta): change updater to use builds (#4310)
https://github.com/multitheftauto/mtasa-blue/issues/3176
This commit is contained in:
parent
6921851da6
commit
9326d48684
@ -11,6 +11,7 @@ fn_update_dl() {
|
||||
# Download and extract files to serverfiles.
|
||||
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "noforce" "nohash"
|
||||
cp -f "${tmpdir}/${remotebuildfilename}" "${serverfiles}/${executable#./}"
|
||||
fn_clear_tmp
|
||||
}
|
||||
|
||||
fn_update_localbuild() {
|
||||
|
@ -23,10 +23,12 @@ fn_update_dl() {
|
||||
echo -e "${extractcmd}" >> "${lgsmlog}"
|
||||
fi
|
||||
echo -e "${extractcmd}"
|
||||
fn_clear_tmp
|
||||
core_exit.sh
|
||||
else
|
||||
fn_print_ok_eol_nl
|
||||
fn_script_log_pass "Extracting ${local_filename}"
|
||||
fn_clear_tmp
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,17 @@ fn_update_dl() {
|
||||
# Download and extract files to tmpdir.
|
||||
fn_fetch_file "http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz" "" "" "" "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "nochmodx" "norun" "force" "nohash"
|
||||
fn_dl_extract "${tmpdir}" "multitheftauto_linux_x64.tar.gz" "${serverfiles}" "multitheftauto_linux_x64"
|
||||
fn_clear_tmp
|
||||
}
|
||||
|
||||
fn_update_localbuild() {
|
||||
# Gets local build info.
|
||||
fn_print_dots "Checking local build: ${remotelocation}"
|
||||
# Uses log file to get local build.
|
||||
localbuild=$(grep "= Multi Theft Auto: San Andreas v" "${serverfiles}/mods/deathmatch/logs/server.log" | awk '{ print $7 }' | sed -r 's/^.{1}//' | tail -1)
|
||||
# Uses executable to get local build.
|
||||
if [ -d "${executabledir}" ]; then
|
||||
cd "${executabledir}" || exit
|
||||
localbuild=$(${executable} -v 2> /dev/null)
|
||||
fi
|
||||
if [ -z "${localbuild}" ]; then
|
||||
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
|
||||
fn_script_log_error "Missing local build info"
|
||||
@ -31,11 +35,11 @@ fn_update_localbuild() {
|
||||
|
||||
fn_update_remotebuild() {
|
||||
# Get remote build info.
|
||||
apiurl="https://api.github.com/repos/multitheftauto/mtasa-blue/releases/latest"
|
||||
apiurl="https://linux.multitheftauto.com/revision/latest.txt"
|
||||
remotebuildresponse=$(curl -s "${apiurl}")
|
||||
remotebuildfilename=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .name')
|
||||
remotebuildurl=$(echo "${remotebuildresponse}" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .browser_download_url')
|
||||
remotebuildversion=$(echo "${remotebuildresponse}" | jq -r '.tag_name')
|
||||
remotebuildfilename="multitheftauto_linux_x64.tar.gz"
|
||||
remotebuildurl="http://linux.mtasa.com/dl/multitheftauto_linux_x64.tar.gz"
|
||||
remotebuildversion=$(echo "${remotebuildresponse}")
|
||||
if [ "${firstcommandname}" != "INSTALL" ]; then
|
||||
fn_print_dots "Checking remote build: ${remotelocation}"
|
||||
# Checks if remotebuildversion variable has been set.
|
||||
|
@ -12,6 +12,7 @@ fn_update_dl() {
|
||||
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "chmodx" "norun" "force" "${remotebuildhash}"
|
||||
cp -f "${tmpdir}/${remotebuildfilename}" "${serverfiles}/${executable#./}"
|
||||
echo "${remotebuildversion}" > "${serverfiles}/build.txt"
|
||||
fn_clear_tmp
|
||||
}
|
||||
|
||||
fn_update_localbuild() {
|
||||
|
@ -20,7 +20,7 @@ fn_update_localbuild() {
|
||||
# Uses executable to get local build.
|
||||
if [ -d "${executabledir}" ]; then
|
||||
cd "${executabledir}" || exit
|
||||
localbuild="$(${preexecutable} ${executable} --version | sed '/^[[:space:]]*$/d')"
|
||||
localbuild="$(${preexecutable} ${executable} --version 2> /dev/null | sed '/^[[:space:]]*$/d')"
|
||||
fi
|
||||
if [ -z "${localbuild}" ]; then
|
||||
fn_print_error "Checking local build: ${remotelocation}: missing local build info"
|
||||
|
Loading…
Reference in New Issue
Block a user