Skip to content

Commit 6271041

Browse files
Flambedgibbs64
andauthored
feat(fastdl): add goldsrc support for the fastdl command (#4472)
* feat(hldmserver): add support for the fastdl command * fix(mods): set exit code to 0 when user cancels mod installation/removal * fix(fastdl): update bzip2 support check and adjust FastDL command conditions --------- Co-authored-by: Daniel Gibbs <[email protected]>
1 parent 8f01d1b commit 6271041

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

lgsm/modules/command_fastdl.sh

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ luasvautorundir="${systemdir}/lua/autorun/server"
2121
luafastdlfile="lgsm_cl_force_fastdl.lua"
2222
luafastdlfullpath="${luasvautorundir}/${luafastdlfile}"
2323

24-
# Check if bzip2 is installed.
25-
if [ ! "$(command -v bzip2 2> /dev/null)" ]; then
26-
fn_print_fail "bzip2 is not installed"
27-
fn_script_log_fail "bzip2 is not installed"
28-
core_exit.sh
29-
fi
30-
3124
# Header
3225
fn_print_header
3326
fn_print_nl "More info: ${italic}https://docs.linuxgsm.com/commands/fastdl"
@@ -112,13 +105,13 @@ fn_fastdl_dirs() {
112105
# Using this gist https://gist.github.com/agunnerson-ibm/efca449565a3e7356906
113106
fn_human_readable_file_size() {
114107
local abbrevs=(
115-
$((1 << 60)):ZB
116-
$((1 << 50)):EB
117-
$((1 << 40)):TB
118-
$((1 << 30)):GB
119-
$((1 << 20)):MB
120-
$((1 << 10)):KB
121-
$((1)):bytes
108+
"1152921504606846976:ZB"
109+
"1125899906842624:EB"
110+
"1099511627776:TB"
111+
"1073741824:GB"
112+
"1048576:MB"
113+
"1024:KB"
114+
"1:bytes"
122115
)
123116

124117
local bytes="${1}"
@@ -225,11 +218,17 @@ fn_fastdl_preview() {
225218
fn_script_log_fail "Generating file list."
226219
core_exit.sh
227220
fi
228-
fn_print_nl "about to compress ${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
221+
222+
if [ "${engine}" == "source" ]; then
223+
echo -e "about to compress ${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
224+
elif [ "${engine}" == "goldsrc" ]; then
225+
echo -e "about to copy ${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
226+
fi
227+
229228
fn_script_log_info "${totalfiles} files, total size $(fn_human_readable_file_size "${filesizetotal}" 0)"
230229
rm -f "${tmpdir:?}/fastdl_files_to_compress.txt"
231230
if ! fn_prompt_yn "Continue?" Y; then
232-
fn_script_log "User exited"
231+
exitcode=0
233232
core_exit.sh
234233
fi
235234
}
@@ -431,7 +430,9 @@ fn_fastdl_preview
431430
fn_clear_old_fastdl
432431
fn_fastdl_dirs
433432
fn_fastdl_build
434-
fn_fastdl_bzip2
433+
if [ "${engine}" == "source" ]; then
434+
fn_fastdl_bzip2
435+
fi
435436
# Finished message.
436437
fn_print_nl "Fastdl files are located in:"
437438
fn_print_nl "${fastdldir}"

lgsm/modules/command_mods_install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ if [ -f "${modsinstalledlistfullpath}" ]; then
8888
fn_script_log_warn "${modprettyname} is already installed"
8989
echo -e " * Any configs may be overwritten."
9090
if ! fn_prompt_yn "Continue?" Y; then
91+
exitcode=0
9192
core_exit.sh
9293
fi
9394
fn_script_log_info "User selected to continue"

lgsm/modules/command_mods_remove.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ done
4747
fn_print_warning_nl "You are about to remove ${cyan}${usermodselect}${default}."
4848
echo -e " * Any custom files/configuration will be removed."
4949
if ! fn_prompt_yn "Continue?" Y; then
50+
exitcode=0
5051
core_exit.sh
5152
fi
5253

lgsm/modules/core_getopt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fi
9696
## Game server exclusive commands.
9797

9898
# FastDL command.
99-
if [ "${engine}" == "source" ]; then
99+
if [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then
100100
currentopt+=("${cmd_fastdl[@]}")
101101
fi
102102

0 commit comments

Comments
 (0)