V8.13.064.2025.10.07

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-10-07 12:51:05 +01:00
parent 181b73b04c
commit 68c803550b
50 changed files with 273 additions and 110 deletions

View File

@@ -15,23 +15,27 @@ guard_sourcing
#######################################
# Print Error Message for Trap on 'ERR' in ${ERROR_LOG}
# Globals:
# VAR_PARAM_COUNT
# VAR_PARAM_STRNG
# VAR_ARG_SANITIZED
# LOG_DEBUG
# ERRCMMD
# ERRCODE
# ERRFUNC
# ERRLINE
# ERRSCRT
# LOG_DEBUG
# LOG_ERROR
# LOG_VAR
# SECONDS
# VAR_ARG_SANITIZED
# VAR_BASH_VER
# VAR_DS_VER
# VAR_EARLY_DEBUG
# VAR_GIT_REL
# VAR_LB_VER
# VAR_PARAM_COUNT
# VAR_PARAM_STRNG
# VAR_SYSTEM
# VAR_VERSION
# Arguments:
# None
# None
#######################################
print_file_err() {
{
@@ -39,6 +43,9 @@ print_file_err() {
printf "❌ Git Commit : %s \n" "${VAR_GIT_REL}"
printf "❌ Version : %s \n" "${VAR_VERSION}"
printf "❌ Hostsystem : %s \n" "${VAR_SYSTEM}"
printf "❌ Bash : %s \n" "${VAR_BASH_VER}"
printf "❌ Live-Build : %s \n" "${VAR_LB_VER}"
printf "❌ Debootstrap : %s \n" "${VAR_DS_VER}"
printf "❌ Error : %s \n" "${ERRCODE}"
printf "❌ Line : %s \n" "${ERRLINE}"
printf "❌ Script : %s \n" "${ERRSCRT}"
@@ -48,41 +55,55 @@ print_file_err() {
printf "❌ Arguments Counter : %s \n" "${VAR_PARAM_COUNT}"
printf "❌ Arguments Original : %s \n" "${VAR_PARAM_STRNG}"
printf "❌ Arguments Sanitized : %s \n" "${VAR_ARG_SANITIZED}"
if "${VAR_EARLY_DEBUG}"; then
printf "❌ Vars Dump saved at : %s \n" "${LOG_VAR}"
printf "❌ Debug Log saved at : %s \n" "${LOG_DEBUG}"
printf "❌ batcat --pager='less -r' %s \n" "${LOG_DEBUG}"
fi
printf "\n"
} >> "${LOG_ERROR}"
}
### Prevents accidental 'unset -f'.
# shellcheck disable=SC2034
readonly -f print_file_err
#######################################
# Print Error Message for Trap on 'ERR' on Terminal
# Globals:
# VAR_PARAM_COUNT
# VAR_PARAM_STRNG
# VAR_ARG_SANITIZED
# LOG_DEBUG
# ERRCMMD
# ERRCODE
# ERRFUNC
# ERRLINE
# ERRSCRT
# LOG_DEBUG
# LOG_ERROR
# LOG_VAR
# SECONDS
# VAR_ARG_SANITIZED
# VAR_BASH_VER
# VAR_DS_VER
# VAR_EARLY_DEBUG
# VAR_GIT_REL
# VAR_LB_VER
# VAR_PARAM_COUNT
# VAR_PARAM_STRNG
# VAR_SYSTEM
# VAR_VERSION
# Arguments:
# None
# None
#######################################
print_scr_err() {
printf "\e[91m❌ CISS.debian.live.builder Script failed. \e[0m\n" >&2
printf "\e[91m❌ Git Commit : %s \e[0m\n" "${VAR_GIT_REL}" >&2
printf "\e[91m❌ Version : %s \e[0m\n" "${VAR_VERSION}" >&2
printf "\e[91m❌ Hostsystem : %s \e[0m\n" "${VAR_SYSTEM}" >&2
printf "\e[91m❌ Bash : %s \e[0m\n" "${VAR_BASH_VER}" >&2
printf "\e[91m❌ Live-Build : %s \e[0m\n" "${VAR_LB_VER}" >&2
printf "\e[91m❌ Debootstrap : %s \e[0m\n" "${VAR_DS_VER}" >&2
printf "\e[91m❌ Error : %s \e[0m\n" "${ERRCODE}" >&2
printf "\e[91m❌ Line : %s \e[0m\n" "${ERRLINE}" >&2
printf "\e[91m❌ Script : %s \e[0m\n" "${ERRSCRT}" >&2
@@ -94,13 +115,20 @@ print_scr_err() {
printf "\e[91m❌ Arguments Sanitized : %s \e[0m\n" "${VAR_ARG_SANITIZED}" >&2
printf "\e[91m❌ Error Log saved at : %s \e[0m\n" "${LOG_ERROR}" >&2
printf "\e[91m❌ batcat --pager='less -r' %s \e[0m\n" "${LOG_ERROR}" >&2
if "${VAR_EARLY_DEBUG}"; then
printf "\e[91m❌ Vars Dump saved at : %s \e[0m\n" "${LOG_VAR}" >&2
printf "\e[91m❌ Debug Log saved at : %s \e[0m\n" "${LOG_DEBUG}" >&2
printf "\e[91m❌ batcat --pager='less -r' %s \e[0m\n" "${LOG_DEBUG}" >&2
fi
printf "\n"
}
### Prevents accidental 'unset -f'.
# shellcheck disable=SC2034
readonly -f print_scr_err
#######################################
# Trap function to be called on 'ERR'.
@@ -112,14 +140,15 @@ print_scr_err() {
# ERRSCRT
# VAR_EARLY_DEBUG
# 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_on_err() {
trap - DEBUG ERR INT TERM
declare -g ERRCODE="$1"
declare -g ERRSCRT="$2"
declare -g ERRLINE="$3"
@@ -129,11 +158,18 @@ trap_on_err() {
declare -g ERRTRAP="true"
if "${VAR_EARLY_DEBUG}"; then dump_user_vars; fi
clean_up "${ERRCODE}"
if ! "${VAR_HANDLER_AUTOBUILD}"; then clean_screen; fi
print_file_err
print_scr_err
}
### Prevents accidental 'unset -f'.
# shellcheck disable=SC2034
readonly -f trap_on_err
#######################################
# Gather all user-defined variables (name and value)
@@ -142,7 +178,7 @@ trap_on_err() {
# VAR_DUMP_VARS_INITIAL
# VAR_VERSION
# Arguments:
# None
# None
#######################################
dump_user_vars() {
### Capture the final snapshot of all variables (excluding '^(BASH|_).*')
@@ -175,4 +211,7 @@ dump_user_vars() {
comm -13 "${VAR_DUMP_VARS_INITIAL}" "${dump_vars_final}" >> "${LOG_VAR}" || true
rm "${VAR_DUMP_VARS_INITIAL}" "${dump_vars_final}"
}
### Prevents accidental 'unset -f'.
# shellcheck disable=SC2034
readonly -f dump_user_vars
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh