Skip to content

Commit

Permalink
feat: collect all artifacts if debug is enabled
Browse files Browse the repository at this point in the history
try to collect all artifacts regardless of the operating system if the debugging mode is enabled (--debug)
  • Loading branch information
tclahr committed Apr 29, 2024
1 parent cfeebaf commit d46c0a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion lib/parse_artifacts_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions uac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit d46c0a9

Please sign in to comment.