From e7401bdabd0d4d600201a807744a0c6dc4532896 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 29 Sep 2024 22:04:04 +0100 Subject: [PATCH] bootstrap trap --- linuxgsm.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/linuxgsm.sh b/linuxgsm.sh index 3d6c66399..feeae4a05 100755 --- a/linuxgsm.sh +++ b/linuxgsm.sh @@ -70,6 +70,18 @@ core_modules.sh() { # Bootstrap # Fetches the core modules required before passed off to core_dl.sh. +fn_bootstrap_fetch_trap() { + echo -e "" + echo -en "downloading ${local_filename}..." + fn_print_canceled_eol_nl + fn_script_log_info "Downloading ${local_filename}...CANCELED" + rm -f "${local_filedir:?}/${local_filename}" + echo -en "downloading ${local_filename}..." + fn_print_removed_eol_nl + fn_script_log_info "Downloading ${local_filename}...REMOVED" + core_exit.sh +} + fn_bootstrap_fetch_file() { remote_fileurl="${1}" remote_fileurl_backup="${2}" @@ -108,7 +120,7 @@ fn_bootstrap_fetch_file() { mkdir -p "${local_filedir}" fi # Trap will remove part downloaded files if canceled. - trap fn_fetch_trap INT + trap fn_bootstrap_fetch_trap INT curlcmd=(curl --connect-timeout 3 --fail -L -o "${local_filedir}/${local_filename}" --retry 2 -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.${randomint}.212 Safari/537.36") # if is large file show progress, else be silent