Browse Source

update ts3 extract

pull/4146/head
Daniel Gibbs 3 years ago
parent
commit
6c65fcbb5c
  1. 11
      lgsm/functions/core_dl.sh
  2. 15
      lgsm/functions/update_ts3.sh

11
lgsm/functions/core_dl.sh

@ -208,6 +208,7 @@ fn_dl_extract() {
local_filedir="${1}"
local_filename="${2}"
extractdest="${3}"
extractsrc="${4}"
# Extracts archives.
echo -en "extracting ${local_filename}..."
@ -223,26 +224,26 @@ fn_dl_extract() {
fi
mime=$(file -b --mime-type "${local_filedir}/${local_filename}")
if [ "${mime}" == "application/gzip" ] || [ "${mime}" == "application/x-gzip" ]; then
if [ -n "${extractsec}" ]; then
extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdest}" "${extractsrc}")
if [ -n "${extractsrc}" ]; then
extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdest}" --strip-components=1 "${extractsrc}")
else
extractcmd=$(tar -zxf "${local_filedir}/${local_filename}" -C "${extractdest}")
fi
elif [ "${mime}" == "application/x-bzip2" ]; then
if [ -n "${extractsrc}" ]; then
extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdest}" "${extractsrc}")
extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdest}" --strip-components=1 "${extractsrc}")
else
extractcmd=$(tar -jxf "${local_filedir}/${local_filename}" -C "${extractdest}")
fi
elif [ "${mime}" == "application/x-xz" ]; then
if [ -n "${extractsrc}" ]; then
extractcmd=$(tar -Jxf "${local_filedir}/${local_filename}" -C "${extractdest}" "${extractsrc}")
extractcmd=$(tar -Jxf "${local_filedir}/${local_filename}" -C "${extractdest}" --strip-components=1 "${extractsrc}")
else
extractcmd=$(tar -Jxf "${local_filedir}/${local_filename}" -C "${extractdest}")
fi
elif [ "${mime}" == "application/zip" ]; then
if [ -n "${extractsrc}" ]; then
extractcmd=$(unzip -qoj -d "${extractdest}" "${local_filedir}/${local_filename}" "${extractsrc}"/*)
extractcmd=$(unzip -qoj -d "${extractdest}" "${local_filedir}/${local_filename}" --strip-components=1 "${extractsrc}"/*)
else
extractcmd=$(unzip -qo -d "${extractdest}" "${local_filedir}/${local_filename}")
fi

15
lgsm/functions/update_ts3.sh

@ -9,20 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_update_dl() {
fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${remotebuildfilename}" "" "norun" "noforce" "${remotebuildhash}"
fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${tmpdir}"
echo -e "copying to ${serverfiles}...\c"
cp -R "${tmpdir}/teamspeak3-server_linux_${ts3arch}/"* "${serverfiles}"
local exitcode=$?
if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "Copying to ${serverfiles}"
fn_clear_tmp
else
fn_print_fail_eol_nl
fn_script_log_fatal "Copying to ${serverfiles}"
fn_clear_tmp
core_exit.sh
fi
fn_dl_extract "${tmpdir}" "${remotebuildfilename}" "${serverfiles}" "teamspeak3-server_linux_${ts3arch}"
}
fn_update_localbuild() {

Loading…
Cancel
Save