From d46c0a99244a9a638ffad113e4dca5a65acae01f Mon Sep 17 00:00:00 2001 From: Thiago Canozzo Lahr Date: Mon, 29 Apr 2024 18:50:38 -0300 Subject: [PATCH] feat: collect all artifacts if debug is enabled try to collect all artifacts regardless of the operating system if the debugging mode is enabled (--debug) --- CHANGELOG.md | 1 + lib/parse_artifacts_file.sh | 4 +++- uac | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a7d2b..dba71f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features - uac.log and uac.log.stderr files were moved to the front of the output archive file (by [rbcrwd](https://github.com/rbcrwd)). +- UAC will try to collect all artifacts regardless of the operating system if the debugging mode is enabled (--debug). ### Artifacts diff --git a/lib/parse_artifacts_file.sh b/lib/parse_artifacts_file.sh index a4dd89f..5d856c6 100644 --- a/lib/parse_artifacts_file.sh +++ b/lib/parse_artifacts_file.sh @@ -29,6 +29,7 @@ parse_artifacts_file() { pa_artifacts_file="${1:-}" pa_root_output_directory="${2:-}" + pa_debug_mode="${3:-false}" # return if artifacts file does not exist if [ ! -f "${pa_artifacts_file}" ]; then @@ -195,8 +196,9 @@ sequence of mappings\n" >&2 # cannot use ! is_element_in_list because it is not accepted by solaris # skip if artifact does not apply to the current operating system + # run all artifacts if debugging mode is on if is_element_in_list "${OPERATING_SYSTEM}" "${pa_supported_os}" \ - || is_element_in_list "all" "${pa_supported_os}"; then + || is_element_in_list "all" "${pa_supported_os}" || ${pa_debug_mode}; then # shellcheck disable=SC2034 pa_do_nothing=true else diff --git a/uac b/uac index 58b398b..f256e85 100755 --- a/uac +++ b/uac @@ -30,9 +30,10 @@ from untarred directory.\n" >&2 fi # set path -PATH="/usr/xpg4/bin:/usr/xpg6/bin:/bin:/sbin:/usr/bin:/usr/sbin" -PATH="${PATH}:/usr/local/bin:/usr/local/sbin:/usr/ucb:/usr/ccs/bin:/opt/bin" -PATH="${PATH}:/opt/sbin:/opt/local/bin:/snap/bin:/netscaler:/opt/homebrew/bin" +ua_path="/usr/xpg4/bin:/usr/xpg6/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" +ua_path="${ua_path}:/usr/local/sbin:/usr/ucb:/usr/ccs/bin:/opt/bin:/opt/sbin" +ua_path="${ua_path}:/opt/local/bin:/snap/bin:/netscaler:/opt/homebrew/bin" +PATH="${ua_path}:${PATH}" export PATH # load lib files @@ -746,7 +747,8 @@ while read ua_artifact_file || [ -n "${ua_artifact_file}" ]; do "${ua_progress_total}" "${ua_progress_timestamp}" "${ua_artifact_file}" ua_artifacts_root_output_directory=`dirname "${ua_artifact_file}"` parse_artifacts_file "${UAC_DIR}/artifacts/${ua_artifact_file}" \ - "${ua_artifacts_root_output_directory}" + "${ua_artifacts_root_output_directory}" \ + "${ua_debug_mode}" find "${TEMP_DATA_DIR}/${ua_artifacts_root_output_directory}" -type f -print \ | sed -e "s|^${TEMP_DATA_DIR}/||" >>"${TEMP_DATA_DIR}/.output_file.tmp" done <"${TEMP_DATA_DIR}/.artifacts.tmp" 2>>"${UAC_STDERR_LOG_FILE}"