V8.00.000.2025.06.17
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -15,8 +15,6 @@ guard_sourcing
|
||||
#######################################
|
||||
# Print Error Message for Trap on 'ERR' in '${ERROR_LOG}'.
|
||||
# Globals:
|
||||
# VAR_PARAM_COUNT
|
||||
# ARG_STR_ORG_INPUT
|
||||
# ERRCMMD
|
||||
# ERRCODE
|
||||
# ERRFUNC
|
||||
@@ -32,6 +30,8 @@ guard_sourcing
|
||||
# VAR_DEBUG_TRACE
|
||||
# VAR_DEBUG_TRAP
|
||||
# VAR_GIT_HEAD
|
||||
# VAR_PARAM_COUNT
|
||||
# VAR_PARAM_STRNG
|
||||
# VAR_SYSTEM
|
||||
# VAR_VERSION
|
||||
# Arguments:
|
||||
@@ -51,7 +51,7 @@ print_file_err() {
|
||||
printf "❌ Script PID : %s %s" "${$}" "${NL}"
|
||||
printf "❌ Script Runtime : %s %s" "${SECONDS}" "${NL}"
|
||||
printf "❌ Arguments Counter : %s %s" "${VAR_PARAM_COUNT}" "${NL}"
|
||||
printf "❌ Arguments Original : %s %s" "${ARG_STR_ORG_INPUT}" "${NL}"
|
||||
printf "❌ Arguments Original : %s %s" "${VAR_PARAM_STRNG}" "${NL}"
|
||||
printf "❌ Arguments Sanitized : %s %s" "${VAR_ARG_SANITIZED}" "${NL}"
|
||||
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then
|
||||
printf "❌ Vars Dump saved at : %s %s" "${LOG_VAR}" "${NL}"
|
||||
@@ -71,10 +71,6 @@ print_file_err() {
|
||||
#######################################
|
||||
# Print Error Message for Trap on 'ERR' on Terminal.
|
||||
# Globals:
|
||||
# VAR_PARAM_COUNT
|
||||
# ARG_STR_ORG_INPUT
|
||||
# RED
|
||||
# RES
|
||||
# ERRCMMD
|
||||
# ERRCODE
|
||||
# ERRFUNC
|
||||
@@ -85,15 +81,19 @@ print_file_err() {
|
||||
# LOG_TRC
|
||||
# LOG_VAR
|
||||
# NL
|
||||
# RED
|
||||
# RES
|
||||
# SECONDS
|
||||
# VAR_ARG_SANITIZED
|
||||
# VAR_DEBUG_TRACE
|
||||
# VAR_DEBUG_TRAP
|
||||
# VAR_GIT_HEAD
|
||||
# VAR_PARAM_COUNT
|
||||
# VAR_PARAM_STRNG
|
||||
# VAR_SYSTEM
|
||||
# VAR_VERSION
|
||||
# Arguments:
|
||||
# None
|
||||
# None
|
||||
#######################################
|
||||
print_scr_err() {
|
||||
printf "%s❌ CISS.debian.installer Script failed. %s%s" "${RED}" "${RES}" "${NL}" >&2
|
||||
@@ -108,7 +108,7 @@ print_scr_err() {
|
||||
printf "%s❌ Script PID : %s %s%s" "${RED}" "${$}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ Script Runtime : %s %s%s" "${RED}" "${SECONDS}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ Arguments Counter : %s %s%s" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ Arguments Original : %s %s%s" "${RED}" "${ARG_STR_ORG_INPUT}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ Arguments Original : %s %s%s" "${RED}" "${VAR_PARAM_STRNG}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ Arguments Sanitized : %s %s%s" "${RED}" "${VAR_ARG_SANITIZED}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ Error Log saved at : %s %s%s" "${RED}" "${LOG_ERR}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ cat %s %s%s" "${RED}" "${LOG_ERR}" "${RES}" "${NL}" >&2
|
||||
@@ -123,9 +123,32 @@ print_scr_err() {
|
||||
printf "%s❌ Debug Log saved at : %s %s%s" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
|
||||
printf "%s❌ cat %s %s%s" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
|
||||
fi
|
||||
print_stacktrace
|
||||
printf "%s" "${NL}"
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Print function() stacktrace.
|
||||
# Globals:
|
||||
# BASH_LINENO
|
||||
# BASH_SOURCE
|
||||
# FUNCNAME
|
||||
# NL
|
||||
# RED
|
||||
# RES
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
print_stacktrace() {
|
||||
if (( ${#FUNCNAME[@]} > 2 )); then
|
||||
printf "%s" "${NL}"
|
||||
printf "%s❌ Call Stack (most recent call first): %s%s" "${RED}" "${RES}" "${NL}" >&2
|
||||
for ((i=1; i<${#FUNCNAME[@]}-1; i++)); do
|
||||
printf "%s❌ ↳ %s() at [%s:%s] %s%s" "${RED}" "${FUNCNAME[i]}" "${BASH_SOURCE[i]}" "${BASH_LINENO[i-1]}" "${RES}" "${NL}" >&2
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Trap function to be called on 'ERR'.
|
||||
# Globals:
|
||||
@@ -134,24 +157,27 @@ print_scr_err() {
|
||||
# ERRFUNC
|
||||
# ERRLINE
|
||||
# ERRSCRT
|
||||
# ERRTRAP
|
||||
# VAR_DEBUG_TRACE
|
||||
# VAR_DEBUG_TRAP
|
||||
# VAR_IN_DIALOG_WR
|
||||
# Arguments:
|
||||
# $1: "$?"
|
||||
# $2: "${BASH_SOURCE[0]}"
|
||||
# $3: "${LINENO}"
|
||||
# $4: "${FUNCNAME[0]:-main}"
|
||||
# $5: "${BASH_COMMAND}"
|
||||
# 1: "$?"
|
||||
# 2: "${BASH_SOURCE[0]}"
|
||||
# 3: "${LINENO}"
|
||||
# 4: "${FUNCNAME[0]:-main}"
|
||||
# 5: "${BASH_COMMAND}"
|
||||
#######################################
|
||||
trap_err() {
|
||||
trap - DEBUG ERR INT
|
||||
declare -g ERRCODE="$1"
|
||||
declare -g ERRSCRT="$2"
|
||||
declare -g ERRLINE="$3"
|
||||
declare -g ERRFUNC="$4"
|
||||
declare -g ERRCMMD="$5"
|
||||
ERRTRAP="true"
|
||||
declare -g ERRTRAP="true"
|
||||
|
||||
trap - DEBUG ERR INT TERM
|
||||
|
||||
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then dump_vars_exiting; fi
|
||||
case "${VAR_IN_DIALOG_WR}" in
|
||||
box ) dialog_box_cleaner ;;
|
||||
|
||||
Reference in New Issue
Block a user