Skip to content

Commit 0ae152d

Browse files
committed
print message when no suitable artifact selected
Prints a message when no artifacts suitable for the target operating system was selected.
1 parent 6469e8c commit 0ae152d

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

uac

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -429,23 +429,28 @@ __ua_collection_progress=0
429429
__ua_collection_progress_total=`echo "${__ua_artifact_list}" | wc -l | awk '{print $1}'`
430430
_log_msg INF "${__ua_collection_progress_total} artifact(s) selected"
431431

432-
printf "%s\n" "Artifacts collection started"
433-
_log_msg INF "Artifacts collection started"
434-
435432
# store artifact list into a file as netscaler raises a segmentation faul in the following situation:
436433
# echo "${__ua_artifact_list}" | while read __ua_artifact; do .....; done
437-
echo "${__ua_artifact_list}" >"${__UAC_TEMP_DATA_DIR}/artifact_list.tmp"
438-
439-
# shellcheck disable=SC2162
440-
while read __ua_artifact || [ -n "${__ua_artifact}" ]; do
441-
__ua_artifact_without_uac_dir=`echo "${__ua_artifact}" | sed -e "s|^${__UAC_DIR}/artifacts/||"`
442-
# shellcheck disable=SC2003,SC2086
443-
__ua_collection_progress=`expr ${__ua_collection_progress} + 1`
444-
__ua_collection_progress_timestamp=`date "+%Y-%m-%d %H:%M:%S %z"`
445-
printf "[%03d/%03d] %s %s\n" "${__ua_collection_progress}" "${__ua_collection_progress_total}" "${__ua_collection_progress_timestamp}" "${__ua_artifact_without_uac_dir}"
446-
_log_msg INF "Parsing ${__ua_artifact_without_uac_dir}"
447-
_parse_artifact "${__ua_artifact}"
448-
done <"${__UAC_TEMP_DATA_DIR}/artifact_list.tmp"
434+
echo "${__ua_artifact_list}" | sed -e '/^$/d' >"${__UAC_TEMP_DATA_DIR}/artifact_list.tmp"
435+
436+
if [ ! -s "${__UAC_TEMP_DATA_DIR}/artifact_list.tmp" ]; then
437+
printf "%s\n" "No artifacts suitable for the target operating system"
438+
_log_msg INF "No artifacts suitable for the target operating system"
439+
else
440+
printf "%s\n" "Artifacts collection started"
441+
_log_msg INF "Artifacts collection started"
442+
443+
# shellcheck disable=SC2162
444+
while read __ua_artifact || [ -n "${__ua_artifact}" ]; do
445+
__ua_artifact_without_uac_dir=`echo "${__ua_artifact}" | sed -e "s|^${__UAC_DIR}/artifacts/||"`
446+
# shellcheck disable=SC2003,SC2086
447+
__ua_collection_progress=`expr ${__ua_collection_progress} + 1`
448+
__ua_collection_progress_timestamp=`date "+%Y-%m-%d %H:%M:%S %z"`
449+
printf "[%03d/%03d] %s %s\n" "${__ua_collection_progress}" "${__ua_collection_progress_total}" "${__ua_collection_progress_timestamp}" "${__ua_artifact_without_uac_dir}"
450+
_log_msg INF "Parsing ${__ua_artifact_without_uac_dir}"
451+
_parse_artifact "${__ua_artifact}"
452+
done <"${__UAC_TEMP_DATA_DIR}/artifact_list.tmp"
453+
fi
449454

450455
# acquisition start date
451456
__ua_acquisition_end_date=`date "+%a %b %d %H:%M:%S %Y %z"`

0 commit comments

Comments
 (0)