V8.00.000.2025.06.17

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-25 13:11:30 +02:00
parent a3a9c2ef14
commit 33121b174f
25 changed files with 260 additions and 150 deletions

View File

@@ -56,6 +56,11 @@
[[ ${#} -eq 0 ]] && {
. ./lib/0000_usage.sh; usage >&2; exit 1; }
### CHECK FOR CONTACT, HELP, AND VERSION STRING.
for arg in "$@"; do case "${arg,,}" in -c|--contact) . ./meta_loader_cuv.sh; contact; exit 0;; esac; done
for arg in "$@"; do case "${arg,,}" in -h|--help) . ./meta_loader_cuv.sh; usage; exit 0;; esac; done
for arg in "$@"; do case "${arg,,}" in -v|--version) . ./meta_loader_cuv.sh; version; exit 0;; esac; done
### SOURCING MUST SET EARLY VARIABLES. SOURCING COLOR_ECHO() AND GUARD_SOURCING().
. ./lib/0010_guard_sourcing.sh
. ./lib/0010_source_guard.sh
@@ -63,11 +68,6 @@ source_guard "./var/color.var.sh"
source_guard "./var/early.var.sh"
source_guard "./lib/0004_color_echo.sh"
### CHECK FOR CONTACT, HELP, AND VERSION STRING.
for arg in "$@"; do case "${arg,,}" in -c|--contact) . ./lib/0001_contact.sh; contact; exit 0;; esac; done
for arg in "$@"; do case "${arg,,}" in -h|--help) . ./lib/0000_usage.sh; usage; exit 0;; esac; done
for arg in "$@"; do case "${arg,,}" in -v|--version) . ./lib/0002_version.sh; version; exit 0;; esac; done
### ALL CHECKS DONE. READY TO START THE SCRIPT.
color_echo "${BLU}" "ALL CHECKS DONE. READY TO START THE SCRIPT."
declare -grx VAR_SETUP="true"
@@ -146,6 +146,11 @@ arg_parser "$@"
color_echo "${BLU}" "PRIORITY UPDATES."
arg_priority_check
### HASHING PASSWORDS.
color_echo "${BLU}" "PRIORITY UPDATES."
nuke_passphrase
# TODO: Implement func() for other passwords.
### MAIN PROGRAM SEQUENCE
color_echo "${BLU}" "YAML PARSER."
yaml_parser

View File

@@ -14,6 +14,10 @@ guard_sourcing
#######################################
# Print-colored text.
# Globals:
# NL
# RES
# WHI
# Arguments:
# 1: Color code.
# *: Text to print.
@@ -22,6 +26,6 @@ color_echo() {
declare c="$1"
shift
declare msg="${*}"
printf "%s[INFO]%s %s%s.%s%s" "${c}" "${RES}" "${WHI}" "${msg}" "${RES}" "${NL}"
printf "%b[INFO]%b %b%s.%b%b" "${c}" "${RES}" "${WHI}" "${msg}" "${RES}" "${NL}"
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -21,7 +21,7 @@ guard_sourcing
# 2: Text string to print on terminal.
#######################################
do_print_color() {
printf "%s\n" "${1}${2}${RES}"
printf "%b\n" "${1}${2}${RES}"
}
#######################################

View File

@@ -76,7 +76,7 @@ do_get_log_color() {
# LOG_INS
# Arguments:
# 1: "${LOG_LEVEL}" one of: "debug" | "info" | "notice" | "warn" | "error" | "critical" | "fatal" | "emergency"
# 2: "${LOG_ONLY}" boolean "true" | "false"
# 2: "${LOG_ONLY}" one of: "file_only" | "tty"
# @: "${MESSAGE[*]}" arbitrary text string to log.
#######################################
do_log() {

View File

@@ -13,24 +13,36 @@
guard_sourcing
#######################################
# Unbound Variable Check and call Trap on ERR.
# Unbound Variable Check.
# Globals:
# ERR_UNBOUND_VARIABLE
# GRE
# NL
# RED
# RES
# Arguments:
# 1: VAR_NAME to check
# 1: VAR_NAME to check NOT the variable itself.
# Returns:
# ERR_UNBOUND_VARIABLE
#######################################
check_var() {
declare var_name_to_check="$1"
if [[ -n "${!var_name_to_check+exists}" ]]; then
### First check: Is the passed-in variable name itself set?
if ! [[ -v var_name_to_check ]]; then
printf "%b❌ Error: Variable NOT set: '%s'. Exiting Script. %b%b" "${RED}" "${var_name_to_check}" "${RES}" "${NL}" >&2
return "${ERR_UNBOUND_VARIABLE}"
fi
### Second check: Is the variable referenced by var_name_to_check declared?
if [[ -v "${var_name_to_check}" ]]; then
if [[ -n "${!var_name_to_check}" ]]; then
printf "\e[92m✅ Variable: '%s' exists and is NOT empty: '%s' \e[0m\n" "${var_name_to_check}" "${!var_name_to_check}"
printf "%b✅ Variable: '%s' exists and is NOT empty: '%s'. %b%b" "${GRE}" "${var_name_to_check}" "${!var_name_to_check}" "${RES}" "${NL}"
else
printf "\e[92m✅ Variable: '%s' exists but is empty. \e[0m\n" "${var_name_to_check}"
printf "%b✅ Variable: '%s' exists but is empty. %b%b" "${GRE}" "${var_name_to_check}" "${RES}" "${NL}"
fi
else
printf "\e[91m❌ Variable: '%s' is not declared. Exiting Script. \e[0m\n" "${var_name_to_check}" >&2
printf "%b❌ Error: Variable NOT declared: '%s'. Exiting Script. %b%b" "${RED}" "${var_name_to_check}" "${RES}" "${NL}" >&2
return "${ERR_UNBOUND_VARIABLE}"
fi
}

View File

@@ -15,17 +15,22 @@ guard_sourcing
#######################################
# Print Error Message for Trap on 'ERR' in '${ERROR_LOG}'.
# Globals:
# BASH_VERSINFO
# EPOCHREALTIME
# ERRCMMD
# ERRCODE
# ERRFUNC
# ERRLINE
# ERRSCRT
# EUID
# HOSTNAME
# LOG_DBG
# LOG_ERR
# LOG_TRC
# LOG_VAR
# NL
# SECONDS
# UID
# VAR_ARG_SANITIZED
# VAR_DEBUG_TRACE
# VAR_DEBUG_TRAP
@@ -39,30 +44,39 @@ guard_sourcing
#######################################
print_file_err() {
{
printf "❌ CISS.debian.installer Script failed. %s" "${NL}"
printf "❌ GIT Commit : %s %s" "${VAR_GIT_HEAD}" "${NL}"
printf "❌ Version : %s %s" "${VAR_VERSION}" "${NL}"
printf "❌ Hostsystem : %s %s" "${VAR_SYSTEM}" "${NL}"
printf "❌ Error : %s %s" "${ERRCODE}" "${NL}"
printf "❌ Line : %s %s" "${ERRLINE}" "${NL}"
printf "❌ Script : %s %s" "${ERRSCRT}" "${NL}"
printf "❌ Function : %s %s" "${ERRFUNC}" "${NL}"
printf "❌ Command : %s %s" "${ERRCMMD}" "${NL}"
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" "${VAR_PARAM_STRNG}" "${NL}"
printf "❌ Arguments Sanitized : %s %s" "${VAR_ARG_SANITIZED}" "${NL}"
printf "❌ CISS.debian.installer Script failed. %b" "${NL}"
printf "❌ GIT Commit : %s %b" "${VAR_GIT_HEAD}" "${NL}"
printf "❌ Version : %s %b" "${VAR_VERSION}" "${NL}"
printf "❌ Epoch : %s %b" "${EPOCHREALTIME}" "${NL}"
printf "❌ Bash MAJ Release : %s %b" "${BASH_VERSINFO[0]}" "${NL}"
printf "❌ Bash MIN Version : %s %b" "${BASH_VERSINFO[1]}" "${NL}"
printf "❌ Bash Patch Level : %s %b" "${BASH_VERSINFO[2]}" "${NL}"
printf "❌ Bash Build Version : %s %b" "${BASH_VERSINFO[3]}" "${NL}"
printf "❌ Bash Release : %s %b" "${BASH_VERSINFO[4]}" "${NL}"
printf "❌ UID : %s %b" "${UID}" "${NL}"
printf "❌ EUID : %s %b" "${EUID}" "${NL}"
printf "❌ Hostname : %s %b" "${HOSTNAME}" "${NL}"
printf "❌ Hostsystem : %s %b" "${VAR_SYSTEM}" "${NL}"
printf "❌ Error : %s %b" "${ERRCODE}" "${NL}"
printf "❌ Line : %s %b" "${ERRLINE}" "${NL}"
printf "❌ Script : %s %b" "${ERRSCRT}" "${NL}"
printf "❌ Function : %s %b" "${ERRFUNC}" "${NL}"
printf "❌ Command : %s %b" "${ERRCMMD}" "${NL}"
printf "❌ Script PID : %s %b" "${$}" "${NL}"
printf "❌ Script Runtime : %s %b" "${SECONDS}" "${NL}"
printf "❌ Arguments Counter : %s %b" "${VAR_PARAM_COUNT}" "${NL}"
printf "❌ Arguments Original : %s %b" "${VAR_PARAM_STRNG}" "${NL}"
printf "❌ Arguments Sanitized : %s %b" "${VAR_ARG_SANITIZED}" "${NL}"
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then
printf "❌ Vars Dump saved at : %s %s" "${LOG_VAR}" "${NL}"
printf "❌ Vars Dump saved at : %s %b" "${LOG_VAR}" "${NL}"
fi
if "${VAR_DEBUG_TRAP}"; then
printf "❌ DEBUG Log saved at : %s %s" "${LOG_DBG}" "${NL}"
printf "❌ cat %s %s" "${LOG_DBG}" "${NL}"
printf "❌ DEBUG Log saved at : %s %b" "${LOG_DBG}" "${NL}"
printf "❌ cat %s %b" "${LOG_DBG}" "${NL}"
fi
if "${VAR_DEBUG_TRACE}"; then
printf "❌ TRACE Log saved at : %s %s" "${LOG_TRC}" "${NL}"
printf "❌ cat %s %s" "${LOG_TRC}" "${NL}"
printf "❌ TRACE Log saved at : %s %b" "${LOG_TRC}" "${NL}"
printf "❌ cat %s %b" "${LOG_TRC}" "${NL}"
fi
printf "%s" "${NL}"
} >> "${LOG_ERR}"
@@ -71,19 +85,22 @@ print_file_err() {
#######################################
# Print Error Message for Trap on 'ERR' on Terminal.
# Globals:
# BASH_VERSINFO
# EPOCHREALTIME
# ERRCMMD
# ERRCODE
# ERRFUNC
# ERRLINE
# ERRSCRT
# EUID
# HOSTNAME
# LOG_DBG
# LOG_ERR
# LOG_TRC
# LOG_VAR
# NL
# RED
# RES
# SECONDS
# UID
# VAR_ARG_SANITIZED
# VAR_DEBUG_TRACE
# VAR_DEBUG_TRAP
@@ -96,35 +113,44 @@ print_file_err() {
# None
#######################################
print_scr_err() {
printf "%s❌ CISS.debian.installer Script failed. %s%s" "${RED}" "${RES}" "${NL}" >&2
printf "%s❌ GIT Commit : %s %s%s" "${RED}" "${VAR_GIT_HEAD}" "${RES}" "${NL}" >&2
printf "%s❌ Version : %s %s%s" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}" >&2
printf "%sHostsystem : %s %s%s" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}" >&2
printf "%sError : %s %s%s" "${RED}" "${ERRCODE}" "${RES}" "${NL}" >&2
printf "%sLine : %s %s%s" "${RED}" "${ERRLINE}" "${RES}" "${NL}" >&2
printf "%sScript : %s %s%s" "${RED}" "${ERRSCRT}" "${RES}" "${NL}" >&2
printf "%sFunction : %s %s%s" "${RED}" "${ERRFUNC}" "${RES}" "${NL}" >&2
printf "%sCommand : %s %s%s" "${RED}" "${ERRCMMD}" "${RES}" "${NL}" >&2
printf "%sScript PID : %s %s%s" "${RED}" "${$}" "${RES}" "${NL}" >&2
printf "%sScript Runtime : %s %s%s" "${RED}" "${SECONDS}" "${RES}" "${NL}" >&2
printf "%sArguments Counter : %s %s%s" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}" >&2
printf "%sArguments Original : %s %s%s" "${RED}" "${VAR_PARAM_STRNG}" "${RES}" "${NL}" >&2
printf "%sArguments Sanitized : %s %s%s" "${RED}" "${VAR_ARG_SANITIZED}" "${RES}" "${NL}" >&2
printf "%sError Log saved at : %s %s%s" "${RED}" "${LOG_ERR}" "${RES}" "${NL}" >&2
printf "%s❌ cat %s %s%s" "${RED}" "${LOG_ERR}" "${RES}" "${NL}" >&2
printf "%b❌ CISS.debian.installer Script failed. %b%b" "${RED}" "${RES}" "${NL}" >&2
printf "%b❌ GIT Commit : %s %b%b" "${RED}" "${VAR_GIT_HEAD}" "${RES}" "${NL}" >&2
printf "%b❌ Version : %s %b%b" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}" >&2
printf "%bEpoch : %s %b%b" "${RED}" "${EPOCHREALTIME}" "${RES}" "${NL}" >&2
printf "%bBash MAJ Release : %s %b%b" "${RED}" "${BASH_VERSINFO[0]}" "${RES}" "${NL}" >&2
printf "%bBash MIN Version : %s %b%b" "${RED}" "${BASH_VERSINFO[1]}" "${RES}" "${NL}" >&2
printf "%bBash Patch Level : %s %b%b" "${RED}" "${BASH_VERSINFO[2]}" "${RES}" "${NL}" >&2
printf "%bBash Build Version : %s %b%b" "${RED}" "${BASH_VERSINFO[3]}" "${RES}" "${NL}" >&2
printf "%bBash Release : %s %b%b" "${RED}" "${BASH_VERSINFO[4]}" "${RES}" "${NL}" >&2
printf "%bUID : %s %b%b" "${RED}" "${UID}" "${RES}" "${NL}" >&2
printf "%bEUID : %s %b%b" "${RED}" "${EUID}" "${RES}" "${NL}" >&2
printf "%bHostname : %s %b%b" "${RED}" "${HOSTNAME}" "${RES}" "${NL}" >&2
printf "%bHostsystem : %s %b%b" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}" >&2
printf "%bError : %s %b%b" "${RED}" "${ERRCODE}" "${RES}" "${NL}" >&2
printf "%bLine : %s %b%b" "${RED}" "${ERRLINE}" "${RES}" "${NL}" >&2
printf "%b❌ Script : %s %b%b" "${RED}" "${ERRSCRT}" "${RES}" "${NL}" >&2
printf "%b❌ Function : %s %b%b" "${RED}" "${ERRFUNC}" "${RES}" "${NL}" >&2
printf "%b❌ Command : %s %b%b" "${RED}" "${ERRCMMD}" "${RES}" "${NL}" >&2
printf "%b❌ Script PID : %s %b%b" "${RED}" "${$}" "${RES}" "${NL}" >&2
printf "%b❌ Script Runtime : %s %b%b" "${RED}" "${SECONDS}" "${RES}" "${NL}" >&2
printf "%b❌ Arguments Counter : %s %b%b" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}" >&2
printf "%b❌ Arguments Original : %s %b%b" "${RED}" "${VAR_PARAM_STRNG}" "${RES}" "${NL}" >&2
printf "%b❌ Arguments Sanitized : %s %b%b" "${RED}" "${VAR_ARG_SANITIZED}" "${RES}" "${NL}" >&2
printf "%b❌ Error Log saved at : %s %b%b" "${RED}" "${LOG_ERR}" "${RES}" "${NL}" >&2
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_ERR}" "${RES}" "${NL}" >&2
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then
printf "%s❌ Vars Dump saved at : %s %s%s" "${RED}" "${LOG_VAR}" "${RES}" "${NL}" >&2
printf "%b❌ Vars Dump saved at : %s %b%b" "${RED}" "${LOG_VAR}" "${RES}" "${NL}" >&2
fi
if "${VAR_DEBUG_TRAP}"; then
printf "%s❌ Debug Log saved at : %s %s%s" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
printf "%s❌ cat %s %s%s" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
printf "%b❌ Debug Log saved at : %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
fi
if "${VAR_DEBUG_TRACE}"; then
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
printf "%b❌ Debug Log saved at : %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
fi
print_stacktrace
printf "%s" "${NL}"
printf "%b" "${NL}"
}
#######################################
@@ -141,10 +167,10 @@ print_scr_err() {
#######################################
print_stacktrace() {
if (( ${#FUNCNAME[@]} > 2 )); then
printf "%s" "${NL}"
printf "%s❌ Call Stack (most recent call first): %s%s" "${RED}" "${RES}" "${NL}" >&2
printf "%b" "${NL}"
printf "%b❌ Call Stack (most recent call first): %b%b" "${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
printf "%b❌ ↳ %s() at [%s:%s] %b%b" "${RED}" "${FUNCNAME[i]}" "${BASH_SOURCE[i]}" "${BASH_LINENO[i-1]}" "${RES}" "${NL}" >&2
done
fi
}

View File

@@ -69,26 +69,26 @@ trap_exit_zero() {
clean_up "${var_trap_exit_zero_code}"
if [[ "${VAR_SCRIPT_SUCCESS}" == "true" ]]; then
printf "%s" "${NL}"
printf "%s✅ CISS.debian.installer Script successful. %s%s" "${GRE}" "${RES}" "${NL}"
printf "%s✅ Exited with Status : %s %s%s" "${GRE}" "${var_trap_exit_zero_code}" "${RES}" "${NL}"
printf "%s" "${NL}"
printf "%b" "${NL}"
printf "%b✅ CISS.debian.installer Script successful. %s%s" "${GRE}" "${RES}" "${NL}"
printf "%b✅ Exited with Status : %s %b%b" "${GRE}" "${var_trap_exit_zero_code}" "${RES}" "${NL}"
printf "%b" "${NL}"
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then
printf "%s✅ Vars Dump saved at : %s %s%s" "${GRE}" "${LOG_VAR}" "${RES}" "${NL}"
printf "%s✅ cat %s %s%s" "${GRE}" "${LOG_VAR}" "${RES}" "${NL}"
printf "%b✅ Vars Dump saved at : %s %b%b" "${GRE}" "${LOG_VAR}" "${RES}" "${NL}"
printf "%b✅ cat %s %b%b" "${GRE}" "${LOG_VAR}" "${RES}" "${NL}"
fi
if [[ "${VAR_DEBUG_TRAP}" == "true" ]]; then
printf "%s✅ DEBUG Log saved at : %s %s%s" "${GRE}" "${LOG_DBG}" "${RES}" "${NL}"
printf "%s✅ cat %s %s%s" "${GRE}" "${LOG_DBG}" "${RES}" "${NL}"
printf "%b✅ DEBUG Log saved at : %s %b%b" "${GRE}" "${LOG_DBG}" "${RES}" "${NL}"
printf "%b✅ cat %s %b%b" "${GRE}" "${LOG_DBG}" "${RES}" "${NL}"
fi
if [[ "${VAR_DEBUG_TRACE}" == "true" ]]; then
printf "%s✅ TRACE Log saved at : %s %s%s" "${GRE}" "${LOG_TRC}" "${RES}" "${NL}"
printf "%s✅ cat %s %s%s" "${GRE}" "${LOG_TRC}" "${RES}" "${NL}"
printf "%b✅ TRACE Log saved at : %s %b%b" "${GRE}" "${LOG_TRC}" "${RES}" "${NL}"
printf "%b✅ cat %s %b%b" "${GRE}" "${LOG_TRC}" "${RES}" "${NL}"
fi
printf "%s" "${NL}"
printf "%s💷 Please consider donating to my work at: %s%s" "${MAG}" "${RES}" "${NL}"
printf "%s🔗 https://coresecret.eu/spenden/ %s%s" "${MAG}" "${RES}" "${NL}"
printf "%s" "${NL}"
printf "%b" "${NL}"
printf "%b💷 Please consider donating to my work at: %b%b" "${MAG}" "${RES}" "${NL}"
printf "%b🔗 https://coresecret.eu/spenden/ %b%b" "${MAG}" "${RES}" "${NL}"
printf "%b" "${NL}"
fi
exit "${var_trap_exit_zero_code}"
}
@@ -134,30 +134,37 @@ trap_exit_non_zero() {
gauge ) dialog_gauge_cleaner ;;
esac
clean_up "${var_code}"
printf "%s❌ CISS.debian.installer Script failed. Most probably cause of unbound variable. %s%s" "${RED}" "${RES}" "${NL}" >&2
printf "%s❌ GIT Commit : %s %s%s" "${RED}" "${VAR_GIT_HEAD}" "${RES}" "${NL}" >&2
printf "%s❌ Version : %s %s%s" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}" >&2
printf "%sHostsystem : %s %s%s" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}" >&2
printf "%sError : %s %s%s" "${RED}" "${var_code}" "${RES}" "${NL}" >&2
printf "%sLine : %s %s%s" "${RED}" "${var_line}" "${RES}" "${NL}" >&2
printf "%sScript : %s %s%s" "${RED}" "${var_scrt}" "${RES}" "${NL}" >&2
printf "%sFunction : %s %s%s" "${RED}" "${var_func}" "${RES}" "${NL}" >&2
printf "%sCommand : %s %s%s" "${RED}" "${var_cmmd}" "${RES}" "${NL}" >&2
printf "%sScript PID : %s %s%s" "${RED}" "${$}" "${RES}" "${NL}" >&2
printf "%sScript Runtime : %s %s%s" "${RED}" "${SECONDS}" "${RES}" "${NL}" >&2
printf "%sArguments Counter : %s %s%s" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}" >&2
printf "%sArguments Original : %s %s%s" "${RED}" "${VAR_PARAM_STRNG}" "${RES}" "${NL}" >&2
printf "%sArguments Sanitized : %s %s%s" "${RED}" "${VAR_ARG_SANITIZED}" "${RES}" "${NL}" >&2
printf "%b❌ CISS.debian.installer Script failed. Most probably cause of unbound variable. %b%b" "${RED}" "${RES}" "${NL}" >&2
printf "%b❌ GIT Commit : %s %b%b" "${RED}" "${VAR_GIT_HEAD}" "${RES}" "${NL}" >&2
printf "%b❌ Version : %s %b%b" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}" >&2
printf "%bEpoch : %s %b%b" "${RED}" "${EPOCHREALTIME}" "${RES}" "${NL}" >&2
printf "%bBash MAJ Release : %s %b%b" "${RED}" "${BASH_VERSINFO[0]}" "${RES}" "${NL}" >&2
printf "%bBash MIN Version : %s %b%b" "${RED}" "${BASH_VERSINFO[1]}" "${RES}" "${NL}" >&2
printf "%bBash Patch Level : %s %b%b" "${RED}" "${BASH_VERSINFO[2]}" "${RES}" "${NL}" >&2
printf "%bUID : %s %b%b" "${RED}" "${UID}" "${RES}" "${NL}" >&2
printf "%bEUID : %s %b%b" "${RED}" "${EUID}" "${RES}" "${NL}" >&2
printf "%bHostname : %s %b%b" "${RED}" "${HOSTNAME}" "${RES}" "${NL}" >&2
printf "%bHostsystem : %s %b%b" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}" >&2
printf "%bError : %s %b%b" "${RED}" "${var_code}" "${RES}" "${NL}" >&2
printf "%bLine : %s %b%b" "${RED}" "${var_line}" "${RES}" "${NL}" >&2
printf "%bScript : %s %b%b" "${RED}" "${var_scrt}" "${RES}" "${NL}" >&2
printf "%b❌ Function : %s %b%b" "${RED}" "${var_func}" "${RES}" "${NL}" >&2
printf "%b❌ Command : %s %b%b" "${RED}" "${var_cmmd}" "${RES}" "${NL}" >&2
printf "%b❌ Script PID : %s %b%b" "${RED}" "${$}" "${RES}" "${NL}" >&2
printf "%b❌ Script Runtime : %s %b%b" "${RED}" "${SECONDS}" "${RES}" "${NL}" >&2
printf "%b❌ Arguments Counter : %s %b%b" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}" >&2
printf "%b❌ Arguments Original : %s %b%b" "${RED}" "${VAR_PARAM_STRNG}" "${RES}" "${NL}" >&2
printf "%b❌ Arguments Sanitized : %s %b%b" "${RED}" "${VAR_ARG_SANITIZED}" "${RES}" "${NL}" >&2
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then
printf "%s❌ Vars Dump saved at : %s %s%s" "${RED}" "${LOG_VAR}" "${RES}" "${NL}" >&2
printf "%b❌ Vars Dump saved at : %s %b%b" "${RED}" "${LOG_VAR}" "${RES}" "${NL}" >&2
fi
if [[ "${VAR_DEBUG_TRAP}" == "true" ]]; then
printf "%s❌ Debug Log saved at : %s %s%s" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
printf "%s❌ cat %s %s%s" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
printf "%b❌ Debug Log saved at : %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}" >&2
fi
if [[ "${VAR_DEBUG_TRACE}" == "true" ]]; then
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
printf "%b❌ Debug Log saved at : %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
fi
print_stacktrace
fi

View File

@@ -34,6 +34,10 @@ restart_dialog() {
# Trap function to be called on 'SIGINT'.
# Globals:
# ERR_TRAPPED_SIG_INT
# GRE
# NL
# RED
# RES
# VAR_IN_DIALOG_WR
# Arguments:
# None
@@ -51,11 +55,11 @@ trap_int() {
declare answer
if ! read -r -t 16 -p $'\n\e[93mCISS.debian.installer caught an INT.\e[0m \e[92mDo you want to abort the Installer? (y/N) \e[0m' answer; then
printf "\e[92mCISS.debian.installer caught an INT. No User confirmation after 16 seconds. Proceeding with Installer. \e[0m\n" >&2
if [[ "${var_helper_dialog}" == box ]]; then
printf "%bCISS.debian.installer caught an INT. No User confirmation after 16 seconds. Proceeding with Installer. %b%b" "${GRE}" "${RES}" "${NL}" >&2
if [[ "${var_helper_dialog}" == "box" ]]; then
restart_dialog "${var_helper_dialog}"
return 0
elif [[ "${var_helper_dialog}" == gauge ]]; then
elif [[ "${var_helper_dialog}" == "gauge" ]]; then
restart_dialog "${var_helper_dialog}"
return 0
else
@@ -66,11 +70,11 @@ trap_int() {
case "${answer,,}" in
y|yes)
printf "\e[91mCISS.debian.installer caught an INT. SIGINT confirmed by User, exiting Installer. \e[0m\n" >&2
printf "%bCISS.debian.installer caught an INT. SIGINT confirmed by User, exiting Installer. %b%b" "${RED}" "${RES}" "${NL}" >&2
exit "${ERR_TRAPPED_SIG_INT}"
;;
*)
printf "\e[92mCISS.debian.installer caught an INT. SIGINT NOT confirmed by User, proceeding with Installer. \e[0m\n" >&2
printf "%bCISS.debian.installer caught an INT. SIGINT NOT confirmed by User, proceeding with Installer. %b%b" "${GRE}" "${RES}" "${NL}" >&2
if [[ "${var_helper_dialog}" == box ]]; then
restart_dialog "${var_helper_dialog}"
return 0

View File

@@ -22,6 +22,8 @@ guard_sourcing
# VAR_NOTES
# Arguments:
# 1: ${var_trap_on_exit_code} of trap_exit()
# Returns:
# 0: On success
#######################################
clean_up() {
declare var_clean_exit_code="$1"
@@ -36,5 +38,6 @@ clean_up() {
### Remove the lockfile artifact.
rm -f /run/lock/ciss_debian_installer.lock
if (( var_clean_exit_code == 0 )); then rm -f -- "${LOG_ERR}"; fi
return 0
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -32,7 +32,7 @@ arg_mismatch() {
box|gauge) "dialog_${VAR_IN_DIALOG_WR}_cleaner" ;;
esac
fi
printf "%s❌ Error: '%s'. %s%s" "${RED}" "${1}" "${RES}" "${NL}" >&2
printf "%b❌ Error: '%s'. %b%b" "${RED}" "${1}" "${RES}" "${NL}" >&2
read -pr $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MISMATCH}"
}

View File

@@ -47,18 +47,20 @@ sanitize_arg() {
disallowed_ctrl=$(printf '%s' "${input}" | sed -n 's/[^[:cntrl:]]//gp' | sed $'s/./&\\n/g' \
| while read -r c; do printf "%02X " "'${c}"; done)
{
printf "❌ Control character : '%s'. %s" "${disallowed_ctrl}" "${NL}"
printf "❌ in argument : '%s'. %s" "${input}" "${NL}"
printf "❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %s" "${NL}"
printf "%s" "${NL}"
printf "❌ Control character : '%s'. %b" "${disallowed_ctrl}" "${NL}"
printf "❌ in argument : '%s'. %b" "${input}" "${NL}"
printf "❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %b" "${NL}"
printf "%b" "${NL}"
} >> "${LOG_ERR}"
case "${VAR_IN_DIALOG_WR}" in
box ) dialog_box_cleaner ;;
gauge ) dialog_gauge_cleaner ;;
esac
printf "%s❌ Control character : '%s'. %s%s" "${RED}" "${disallowed_ctrl}" "${RES}" "${NL}" >&2
printf "%s in argument : '%s'. %s%s" "${RED}" "${input}" "${RES}" "${NL}" >&2
printf "%sAllowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %s%s" "${RED}" "${RES}" "${NL}" >&2
printf "%bControl character : '%s'. %b%b" "${RED}" "${disallowed_ctrl}" "${RES}" "${NL}" >&2
printf "%b in argument : '%s'. %b%b" "${RED}" "${input}" "${RES}" "${NL}" >&2
printf "%b❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %b%b" "${RED}" "${RES}" "${NL}" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_UNSAFE_CHARACTER}"
@@ -71,18 +73,18 @@ sanitize_arg() {
disallowed=$(printf '%s' "${input}" | tr -d "${allowed}")
if [[ -n ${disallowed} ]]; then
{
printf "❌ Invalid character : '%s'. %s" "${disallowed//?/& }" "${NL}"
printf "❌ in argument : '%s'. %s" "${input}" "${NL}"
printf "❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %s" "${NL}"
printf "%s" "${NL}"
printf "❌ Invalid character : '%s'. %b" "${disallowed//?/& }" "${NL}"
printf "❌ in argument : '%s'. %b" "${input}" "${NL}"
printf "❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %b" "${NL}"
printf "%b" "${NL}"
} >> "${LOG_ERR}"
case "${VAR_IN_DIALOG_WR}" in
box ) dialog_box_cleaner ;;
gauge ) dialog_gauge_cleaner ;;
esac
printf "%s❌ Invalid character : '%s'. %s%s" "${RED}" "${disallowed//?/& }" "${RES}" "${NL}" >&2
printf "%s❌ in argument : '%s'. %s%s" "${RED}" "${input}" "${RES}" "${NL}" >&2
printf "%s❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %s%s" "${RED}" "${RES}" "${NL}" >&2
printf "%s❌ Invalid character : '%s'. %b%b" "${RED}" "${disallowed//?/& }" "${RES}" "${NL}" >&2
printf "%b❌ in argument : '%s'. %b%b" "${RED}" "${input}" "${RES}" "${NL}" >&2
printf "%b❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' %b%b" "${RED}" "${RES}" "${NL}" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_UNSAFE_CHARACTER}"

View File

@@ -30,14 +30,14 @@ arg_priority_check() {
if [[ -n "${VAR_PRIORITY}" ]]; then
renice "${VAR_PRIORITY}" -p "$$" > /dev/null 2>&1
var=$(ps -o ni= -p $$) > /dev/null 2>&1
do_log "info" "file_only" "New renice value: '${var}'."
do_log "info" "tty" "New renice value: '${var}'."
fi
### Check if ionice PRIORITY is set and adjust ionice priority.
if [[ -n "${VAR_REIONICE_CLASS}" ]]; then
ionice -c"${VAR_REIONICE_CLASS}" -n"${VAR_REIONICE_PRIORITY}" -p "$$"
var=$(ionice -p $$) > /dev/null 2>&1
do_log "info" "file_only" "New ionice value: '${var}'."
do_log "info" "tty" "New ionice value: '${var}'."
fi
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -37,6 +37,7 @@ nuke_passphrase() {
### Turn on tracing again
[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
# shellcheck disable=SC2312
var_salt=$(tr -dc 'A-Za-z0-9' < /dev/random | head -c 16)
### No tracing for security reasons

View File

@@ -10,6 +10,8 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
guard_sourcing
#######################################
# Terminal cleaner for Dialog Wrappers.
# Arguments:

20
meta_loader_cuv.sh Normal file
View File

@@ -0,0 +1,20 @@
#!/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
### SOURCING CONTACT, USAGE, VERSION MODULES FOR RAPID REACTION.
. ./lib/0000_usage.sh
. ./lib/0001_contact.sh
. ./lib/0002_version.sh
. ./var/early.var.sh
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -10,6 +10,10 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
### SOURCING PRELIMINARY FUNCTIONS AND VARIABLES IN CASE OF FAILED PRELIMINARY CHECKS.
. ./lib/0010_guard_sourcing.sh
. ./lib/0010_source_guard.sh
. ./var/color.var.sh
. ./var/errors.var.sh

View File

@@ -14,7 +14,6 @@
. ./func/helper/1080_helper_chroot.sh
. ./func/helper/1081_helper_grub.sh
. ./func/helper/1082_helper_modules.sh
. ./func/helper/1083_helper_print.sh
. ./func/helper/1084_helper_sanitizer.sh
. ./func/helper/1085_helper_secure_dl.sh
. ./func/helper/1086_helper_yaml.sh

View File

@@ -10,29 +10,30 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
. ./lib/0011_guard_safe_exec.sh
. ./lib/0020_gen_dir_files.sh
. ./lib/0025_logging_modules.sh
. ./lib/0030_check_pkgs.sh
. ./lib/0031_check_git.sh
. ./lib/0040_check_var.sh
. ./lib/0050_debug_pre_scan.sh
. ./lib/0051_debug_var_dump.sh
. ./lib/0052_debug_trace.sh
. ./lib/0053_debug_trace_header.sh
. ./lib/0054_debug_trap.sh
. ./lib/0055_debug_trap_header.sh
. ./lib/0060_trap_err.sh
. ./lib/0070_trap_exit.sh
. ./lib/0080_trap_int.sh
. ./lib/0090_clean_up.sh
. ./lib/0100_arg_mismatch.sh
. ./lib/0101_arg_sanitizer.sh
. ./lib/0102_arg_parser.sh
. ./lib/0103_arg_priority_check.sh
. ./lib/0104_arg_nuke_converter.sh
#. ./lib/0110_check_kernel.sh
#. ./lib/0120_check_provider.sh
. ./lib/0200_dialog_helper.sh
source_guard "./lib/0011_guard_safe_exec.sh"
source_guard "./lib/0020_gen_dir_files.sh"
source_guard "./lib/0024_logging_helper.sh"
source_guard "./lib/0025_logging_modules.sh"
source_guard "./lib/0030_check_pkgs.sh"
source_guard "./lib/0031_check_git.sh"
source_guard "./lib/0040_check_var.sh"
source_guard "./lib/0050_debug_pre_scan.sh"
source_guard "./lib/0051_debug_var_dump.sh"
source_guard "./lib/0052_debug_trace.sh"
source_guard "./lib/0053_debug_trace_header.sh"
source_guard "./lib/0054_debug_trap.sh"
source_guard "./lib/0055_debug_trap_header.sh"
source_guard "./lib/0060_trap_err.sh"
source_guard "./lib/0070_trap_exit.sh"
source_guard "./lib/0080_trap_int.sh"
source_guard "./lib/0090_clean_up.sh"
source_guard "./lib/0100_arg_mismatch.sh"
source_guard "./lib/0101_arg_sanitizer.sh"
source_guard "./lib/0102_arg_parser.sh"
source_guard "./lib/0103_arg_priority_check.sh"
source_guard "./lib/0104_arg_nuke_converter.sh"
#source_guard "./lib/0110_check_kernel.sh"
#source_guard "./lib/0120_check_provider.sh"
source_guard "./lib/0200_dialog_helper.sh"
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -10,10 +10,9 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
. ./var/bash.var.sh
source_guard "./var/color.var.sh"
. ./var/errors.var.sh
. ./var/global.var.sh
. ./var/terminal.var.sh
source_guard "./var/bash.var.sh"
source_guard "./var/errors.var.sh"
source_guard "./var/global.var.sh"
source_guard "./var/terminal.var.sh"
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh

View File

@@ -10,6 +10,8 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
guard_sourcing
### For all options see https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
set -o errexit # Exit script when a command exits with non-zero status, the same as "set -e".
set -o errtrace # Any traps on ERR are inherited in a subshell environment, the same as "set -E".

View File

@@ -12,6 +12,8 @@
guard_sourcing
### Definition of color variables.
declare -grx BLA='\e[90m' # Beautiful black for the techno fans.
declare -grx RED='\e[91m' # Bright red.
declare -grx GRE='\e[92m' # Vibrant green.

View File

@@ -10,14 +10,16 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
### Definition of MUST set early Variables
guard_sourcing
### Definition of MUST set early variables.
# shellcheck disable=SC2155
declare -ag ARY_PARAM_ARRAY=("$@")
declare -grx VAR_PARAM_COUNT="$#"
declare -grx VAR_PARAM_STRNG="$*"
declare -grx VAR_CONTACT="security@coresecret.eu"
declare -grx VAR_VERSION="Master V8.00.000.2025.06.17"
# shellcheck disable=SC2155
declare -grx VAR_SYSTEM="$(uname -a)"
declare -gx VAR_ARG_SANITIZED=""
declare -gx VAR_AUTO_INSTALL="false"

View File

@@ -10,7 +10,10 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
### Definition of error codes
guard_sourcing
### Definition of error codes.
declare -girx ERR_UNSUPPORTED_BASH=255 # The Bash is not supported.
declare -girx ERR_USER_IS_NOT_ROOT=254 # Not running as root.
declare -girx ERR_UNSAFE_CHARACTER=253 # An invalid character has been used.
@@ -47,7 +50,7 @@ declare -girx ERR_PATH_NOT_VALID=223 # Specific path is not existing.
declare -girx ERR_READ_NUKE_FILE=222 # Error reading Luks Nuke password file.
declare -girx ERR_READ_GRUB_FILE=221 # Error reading Grub password file.
### Definition of error trap vars
### Definition of error trap vars.
declare -gx ERRCODE="" # = $? = $1 = ERRCODE
declare -gx ERRSCRT="" # = ${BASH_SOURCE[0]} = $2 = ERRSCRT
declare -gx ERRLINE="" # = ${LINENO} = $3 = ERRLINE

View File

@@ -10,17 +10,24 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
### Definition of MUST set global Variables.
guard_sourcing
### Definition of MUST set global variables.
# shellcheck disable=SC2155
declare -grx VAR_KERNEL_INF=$(mktemp var_kernel_inf.XXXXXXXX)
# shellcheck disable=SC2155
declare -grx VAR_KERNEL_TMP=$(mktemp var_kernel_tmp.XXXXXXXX)
# shellcheck disable=SC2155
declare -grx VAR_KERNEL_SRT=$(mktemp var_kernel_srt.XXXXXXXX)
# shellcheck disable=SC2155
declare -grx VAR_NOTES=$(mktemp var_notes.XXXXXXXX)
declare -grx VAR_SETUP_CONF="preseed.yaml"
declare -grx VAR_SETUP_PART="partitioning.yaml"
declare -grx VAR_SETUP_FILE="${0##*/}" # 'setup.sh'
# shellcheck disable=SC2155
declare -grx VAR_SETUP_PATH="$(cd "$(dirname "${0}")" && pwd)" # '/opt/git/CISS.debian.installer'
# shellcheck disable=SC2155
declare -grx VAR_SETUP_FULL="$(cd "$(dirname "${0}")" && pwd)/${0##*/}" # '/opt/git/CISS.debian.installer/setup.sh'
### Initialize variables of different directories.

View File

@@ -10,8 +10,13 @@
# SPDX-PackageName: CISS.debian.installer
# SPDX-Security-Contact: security@coresecret.eu
guard_sourcing
### Definition of terminal variables.
# shellcheck disable=SC2155
declare -gix ROWS=$(tput lines)
# shellcheck disable=SC2155
declare -gix COLS=$(tput cols)
declare -gix ROWS_USE=$(($(tput lines) - 8))
declare -gix COLS_USE=$(($(tput cols) - 8))