Browse Source

extracts will now fail if files doesnt exist

pull/4146/head
Daniel Gibbs 3 years ago
parent
commit
b376e678cb
  1. 14
      lgsm/functions/core_dl.sh
  2. 3
      lgsm/functions/update_ut99.sh

14
lgsm/functions/core_dl.sh

@ -14,8 +14,8 @@
# hash: Optional, set an hash sum and will compare it against the file.
#
# Downloads can be defined in code like so:
# fn_fetch_file "${remote_fileurl}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
# fn_fetch_file "http://example.com/file.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd"
# fn_fetch_file "${remote_fileurl}" "${remote_fileurl_backup}" "${remote_fileurl_name}" "${remote_fileurl_backup_name}" "${local_filedir}" "${local_filename}" "${chmodx}" "${run}" "${forcedl}" "${hash}"
# fn_fetch_file "http://example.com/file.tar.bz2" "http://example.com/file2.tar.bz2" "file.tar.bz2" "file2.tar.bz2" "/some/dir" "file.tar.bz2" "chmodx" "run" "forcedl" "10cd7353aa9d758a075c600a6dd193fd"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
@ -210,10 +210,18 @@ fn_dl_extract() {
extractdir="${3}"
# Extracts archives.
echo -en "extracting ${local_filename}..."
mime=$(file -b --mime-type "${local_filedir}/${local_filename}")
if [ ! -d "${extractdir}" ]; then
mkdir "${extractdir}"
fi
if [ ! -f "${local_filedir}/${local_filename}" ]; then
fn_print_fail_eol_nl
echo -en "file ${local_filedir}/${local_filename} not found"
fn_script_log_fatal "extracting ${local_filename}"
fn_script_log_fatal "File ${local_filedir}/${local_filename} not found"
core_exit.sh
fi
mime=$(file -b --mime-type "${local_filedir}/${local_filename}")
if [ "${mime}" == "application/gzip" ] || [ "${mime}" == "application/x-gzip" ]; then
extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdir}")
elif [ "${mime}" == "application/x-bzip2" ]; then

3
lgsm/functions/update_ut99.sh

@ -11,7 +11,7 @@ fn_update_ut99_dl() {
remotebuildurl=$(curl --connect-timeout 10 -sL "https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .browser_download_url')
remotebuildfilename=$(curl --connect-timeout 10 -sL "https://api.github.com/repos/OldUnreal/UnrealTournamentPatches/releases/latest" | jq -r '.assets[]|select(.browser_download_url | contains("Linux-amd64")) | .name')
fn_fetch_file "${remotebuildurl}" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "nohash"
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "nohash"
fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}"
echo "${remotebuild}" > "${serverfiles}/build.txt"
}
@ -75,7 +75,6 @@ fn_update_ut99_compare() {
check_status.sh
# If server stopped.
if [ "${status}" == "0" ]; then
exitbypass=1
fn_update_ut99_dl
if [ "${localbuild}" == "0" ]; then
exitbypass=1

Loading…
Cancel
Save