Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hldmserver): add support for the fastdl command #4472

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lgsm/modules/command_fastdl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
luasvautorundir="${systemdir}/lua/autorun/server"
luafastdlfile="lgsm_cl_force_fastdl.lua"
luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
# Only Source supports bzip2 compression.
if [ "${engine}" == "source" ]; then
supportsbzip=""
fi

# Check if bzip2 is installed.
if [ ! "$(command -v bzip2 2> /dev/null)" ]; then
if [ -v supportsbzip ] && [ ! "$(command -v bzip2 2> /dev/null)" ]; then
fn_print_fail "bzip2 is not installed"
fn_script_log_fail "bzip2 is not installed"
core_exit.sh
Expand Down Expand Up @@ -225,7 +229,10 @@
fn_script_log_fail "Generating file list."
core_exit.sh
fi
echo -e "about to compress ${totalfiles} files, total size $(fn_human_readable_file_size ${filesizetotal} 0)"
if [ -v supportsbzip ]; then
compressionmessage="about to compress ${totalfiles} files, "
fi
echo -e "${compressionmessage}total size $(fn_human_readable_file_size ${filesizetotal} 0)"

Check warning on line 235 in lgsm/modules/command_fastdl.sh

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

lgsm/modules/command_fastdl.sh#L235

Double quote to prevent globbing and word splitting.
fn_script_log_info "${totalfiles} files, total size $(fn_human_readable_file_size ${filesizetotal} 0)"
rm -f "${tmpdir:?}/fastdl_files_to_compress.txt"
if ! fn_prompt_yn "Continue?" Y; then
Expand Down Expand Up @@ -431,7 +438,9 @@
fn_clear_old_fastdl
fn_fastdl_dirs
fn_fastdl_build
fn_fastdl_bzip2
if [ -v supportsbzip ]; then
fn_fastdl_bzip2
fi
# Finished message.
echo -e "FastDL files are located in:"
echo -e "${fastdldir}"
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/core_getopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fi
## Game server exclusive commands.

# FastDL command.
if [ "${engine}" == "source" ]; then
if [ "${engine}" == "source" ] || [ "${shortname}" == "hldm" ]; then
currentopt+=("${cmd_fastdl[@]}")
fi

Expand Down