V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m0s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
44
lib/cdi_0050_debug/0052_debug_trace.sh
Normal file
44
lib/cdi_0050_debug/0052_debug_trace.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
# SPDX-Version: 3.0
|
||||
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.installer.git
|
||||
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
|
||||
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
|
||||
# SPDX-FileType: SOURCE
|
||||
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
|
||||
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
|
||||
# SPDX-PackageName: CISS.debian.installer
|
||||
# SPDX-Security-Contact: security@coresecret.eu
|
||||
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
# Wrapper for XTRACE Debug.
|
||||
# Globals:
|
||||
# BASH_XTRACEFD
|
||||
# DIR_LOG
|
||||
# LOG_TRC
|
||||
# PS4
|
||||
# SHELLOPTS
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
debug_trace() {
|
||||
### Set a verbose PS4 prompt including timestamp, source, line, exit status of previous command, and function name
|
||||
declare -grx PS4='\e[97m+\e[0m\e[96m$(date -u +%Y-%m-%dT%H:%M:%S.%4N%z)\e[0m\e[97m:\e[0m\e[92m[${BASH_SOURCE[0]}:${LINENO}]\e[0m\e[97m|\e[0m\e[93m${?}\e[0m\e[97m>\e[0m\e[95m${FUNCNAME[0]:-main}()\e[0m \e[97m>>\e[0m '
|
||||
# shellcheck disable=SC2155
|
||||
declare -grx LOG_TRC="${DIR_LOG}/ciss_debian_installer_$$_trace.log"
|
||||
### Generates empty LOG_TRC
|
||||
touch "${LOG_TRC}" && chmod 0600 "${LOG_TRC}"
|
||||
### Open file descriptor 42 for writing to the debug log
|
||||
exec 42>| "${LOG_TRC}"
|
||||
### Write Debug Log Header https://www.gnu.org/software/bash/manual/html_node/Bash-Variables
|
||||
debug_trace_header "$#" "$*"
|
||||
### Tell Bash to send xtrace output to FD 42
|
||||
export BASH_XTRACEFD=42
|
||||
### Enable inheritable shell options
|
||||
export SHELLOPTS
|
||||
### Turn on xtrace
|
||||
set -x
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user