V8.13.064.2025.10.07
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -15,15 +15,18 @@ guard_sourcing
|
||||
#######################################
|
||||
# Wrapper for statistic functions of the final build.
|
||||
# Globals:
|
||||
# ERR_UNCRITICAL
|
||||
# VAR_BUILD_LOG
|
||||
# VAR_CHROOT_DIR
|
||||
# VAR_HANDLER_BUILD_DIR
|
||||
# VAR_PACKAGES_FILE
|
||||
# Arguments:
|
||||
# None
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
# ERR_UNCRITICAL: on failure
|
||||
#######################################
|
||||
run_analysis() {
|
||||
clear
|
||||
# shellcheck disable=SC2164
|
||||
cd "${VAR_HANDLER_BUILD_DIR}"
|
||||
# shellcheck disable=SC2155
|
||||
@@ -51,12 +54,14 @@ run_analysis() {
|
||||
declare squash_cpu_used="$(grep -m1 -oP 'Using \K[0-9]+' "${VAR_BUILD_LOG}")"
|
||||
|
||||
if [[ -f "${VAR_BUILD_LOG}" ]]; then
|
||||
|
||||
# shellcheck disable=SC2155
|
||||
declare start_line=$(grep 'lb build' "${VAR_BUILD_LOG}" | head -n1 || true)
|
||||
# shellcheck disable=SC2155
|
||||
declare end_line=$(grep 'lb source' "${VAR_BUILD_LOG}" | tail -n1 || true)
|
||||
|
||||
if [[ -n "${start_line}" && -n "${end_line}" ]]; then
|
||||
|
||||
# shellcheck disable=SC2155
|
||||
declare start_epoch=$(echo "${start_line}" | sed -E 's/^\[([0-9:-]+ [0-9:]+)\].*/\1/' | xargs -I{} date -d "{}" +%s)
|
||||
# shellcheck disable=SC2155
|
||||
@@ -69,15 +74,21 @@ run_analysis() {
|
||||
declare duration_rest=$((duration_sec % 60))
|
||||
# shellcheck disable=SC2155
|
||||
declare build_duration=$(printf "%02dm:%02ds" "${duration_min}" "${duration_rest}")
|
||||
|
||||
else
|
||||
|
||||
declare build_duration="(Timestamp not found)"
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
declare build_duration="(No log file found)"
|
||||
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2155
|
||||
declare sha_sum=$(sha256sum "$iso_file" | tee "$iso_file.sha256" | awk '{print $1}')
|
||||
declare sha_sum=$(sha256sum "${iso_file}" | tee "${iso_file}.sha256" | awk '{print $1}')
|
||||
# shellcheck disable=SC2155
|
||||
declare time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
@@ -94,5 +105,10 @@ run_analysis() {
|
||||
printf "\e[92m----------------------------------------------------------------------------------------\e[0m\n"
|
||||
printf "\e[97m📅 Analysis Time : %s \e[0m\n" "${time}"
|
||||
printf "\e[92m✅ Analysis completed.\e[0m\n"
|
||||
|
||||
return 0
|
||||
}
|
||||
### Prevents accidental 'unset -f'.
|
||||
# shellcheck disable=SC2034
|
||||
readonly -f run_analysis
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
Reference in New Issue
Block a user