All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 42s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
75 lines
2.4 KiB
Bash
75 lines
2.4 KiB
Bash
#!/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
|
|
|
|
#######################################
|
|
# Capture an initial snapshot of all variables (excluding '^(BASH|_).*').
|
|
# Globals:
|
|
# VAR_DUMP_VARS_INITIAL
|
|
# Arguments:
|
|
# None
|
|
#######################################
|
|
dump_vars_initial() {
|
|
# shellcheck disable=SC2155
|
|
declare -grx VAR_DUMP_VARS_INITIAL=$(mktemp var_dump_vars_initial.XXXXXXXX)
|
|
# shellcheck disable=SC2312
|
|
{
|
|
declare var
|
|
while IFS= read -r var; do
|
|
declare -p "${var}" 2> /dev/null
|
|
done < <(compgen -v | grep -Ev '^(BASH|_).*')
|
|
} | sort >| "${VAR_DUMP_VARS_INITIAL}"
|
|
}
|
|
|
|
#######################################
|
|
# Gather all user-defined variables (name and value).
|
|
# Globals:
|
|
# LOG_VAR
|
|
# VAR_DUMP_VARS_INITIAL
|
|
# VAR_VERSION
|
|
# Arguments:
|
|
# None
|
|
#######################################
|
|
dump_vars_exiting() {
|
|
### Capture the final snapshot of all variables (excluding '^(BASH|_).*')
|
|
# shellcheck disable=SC2155
|
|
declare var_dump_vars_final=$(mktemp var_dump_vars_final.XXXXXXXX)
|
|
set +x
|
|
# shellcheck disable=SC2312
|
|
{
|
|
declare var
|
|
while IFS= read -r var; do
|
|
declare -p "${var}" 2>/dev/null
|
|
done < <(compgen -v | grep -Ev '^(BASH|_).*')
|
|
} | sort >| "${var_dump_vars_final}"
|
|
|
|
{
|
|
printf "✅ CISS.debian.installer Config Variable Dump. \n"
|
|
printf "✅ Version : %s \n" "${VAR_VERSION}"
|
|
printf "\n"
|
|
printf "===== Initial VAR Environment ===== \n"
|
|
} >> "${LOG_VAR}"
|
|
|
|
comm -23 "${VAR_DUMP_VARS_INITIAL}" "${var_dump_vars_final}" >> "${LOG_VAR}" || true
|
|
|
|
{
|
|
printf "\n"
|
|
printf "===== Final VAR Environment ===== \n"
|
|
} >> "${LOG_VAR}"
|
|
|
|
comm -13 "${VAR_DUMP_VARS_INITIAL}" "${var_dump_vars_final}" >> "${LOG_VAR}" || true
|
|
set -x
|
|
rm -f "${VAR_DUMP_VARS_INITIAL}" "${var_dump_vars_final}"
|
|
}
|
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|