V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 41s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 41s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -77,16 +77,18 @@ do_get_log_color() {
|
||||
# Arguments:
|
||||
# 1: "${LOG_LEVEL}" one of: "debug" | "info" | "notice" | "warn" | "error" | "critical" | "fatal" | "emergency"
|
||||
# 2: "${LOG_ONLY}" one of: "file_only" | "tty"
|
||||
# @: "${MESSAGE[*]}" arbitrary text string to log.
|
||||
# *: "${*}" arbitrary text string to log.
|
||||
#######################################
|
||||
do_log() {
|
||||
### Reading arguments.
|
||||
declare var_log_level="$1"; shift
|
||||
declare var_log_only="$2"; shift
|
||||
declare ary_message=("$@")
|
||||
declare var_msg_string="${ary_message[*]}"
|
||||
declare var_log_only="$1"; shift
|
||||
declare var_msg_string="${*}"
|
||||
|
||||
### Declare variables.
|
||||
declare var_color; var_color=$(do_get_log_color "${var_log_level}")
|
||||
declare var_ts; var_ts="$(date -u '+%Y-%m-%dT%H:%M:%S.%4N%z')"
|
||||
declare var_log_entry=("${var_ts} [${var_log_level}]: ${ary_message[*]}")
|
||||
declare var_log_entry=("${var_ts} [${var_log_level}]: ${var_msg_string}")
|
||||
|
||||
if do_should_log "${var_log_level}"; then
|
||||
if [[ "${var_log_only,,}" == "file_only" ]]; then
|
||||
|
||||
@@ -113,41 +113,41 @@ print_file_err() {
|
||||
# None
|
||||
#######################################
|
||||
print_scr_err() {
|
||||
printf "%b❌ CISS.debian.installer Script failed. %b%b" "${RED}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ GIT Commit : %s %b%b" "${RED}" "${VAR_GIT_REL}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Version : %s %b%b" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Epoch : %s %b%b" "${RED}" "${EPOCHREALTIME}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash MAJ Release : %s %b%b" "${RED}" "${BASH_VERSINFO[0]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash MIN Version : %s %b%b" "${RED}" "${BASH_VERSINFO[1]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash Patch Level : %s %b%b" "${RED}" "${BASH_VERSINFO[2]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash Build Version : %s %b%b" "${RED}" "${BASH_VERSINFO[3]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash Release : %s %b%b" "${RED}" "${BASH_VERSINFO[4]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ UID : %s %b%b" "${RED}" "${UID}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ EUID : %s %b%b" "${RED}" "${EUID}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Hostname : %s %b%b" "${RED}" "${HOSTNAME}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Hostsystem : %s %b%b" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Error : %s %b%b" "${RED}" "${ERRCODE}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Line : %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
|
||||
printf "%b❌ CISS.debian.installer Script failed. %b%b" "${RED}" "${RES}" "${NL}"
|
||||
printf "%b❌ GIT Commit : %s %b%b" "${RED}" "${VAR_GIT_REL}" "${RES}" "${NL}"
|
||||
printf "%b❌ Version : %s %b%b" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}"
|
||||
printf "%b❌ Epoch : %s %b%b" "${RED}" "${EPOCHREALTIME}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash MAJ Release : %s %b%b" "${RED}" "${BASH_VERSINFO[0]}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash MIN Version : %s %b%b" "${RED}" "${BASH_VERSINFO[1]}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash Patch Level : %s %b%b" "${RED}" "${BASH_VERSINFO[2]}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash Build Version : %s %b%b" "${RED}" "${BASH_VERSINFO[3]}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash Release : %s %b%b" "${RED}" "${BASH_VERSINFO[4]}" "${RES}" "${NL}"
|
||||
printf "%b❌ UID : %s %b%b" "${RED}" "${UID}" "${RES}" "${NL}"
|
||||
printf "%b❌ EUID : %s %b%b" "${RED}" "${EUID}" "${RES}" "${NL}"
|
||||
printf "%b❌ Hostname : %s %b%b" "${RED}" "${HOSTNAME}" "${RES}" "${NL}"
|
||||
printf "%b❌ Hostsystem : %s %b%b" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}"
|
||||
printf "%b❌ Error : %s %b%b" "${RED}" "${ERRCODE}" "${RES}" "${NL}"
|
||||
printf "%b❌ Line : %s %b%b" "${RED}" "${ERRLINE}" "${RES}" "${NL}"
|
||||
printf "%b❌ Script : %s %b%b" "${RED}" "${ERRSCRT}" "${RES}" "${NL}"
|
||||
printf "%b❌ Function : %s %b%b" "${RED}" "${ERRFUNC}" "${RES}" "${NL}"
|
||||
printf "%b❌ Command : %s %b%b" "${RED}" "${ERRCMMD}" "${RES}" "${NL}"
|
||||
printf "%b❌ Script PID : %s %b%b" "${RED}" "${$}" "${RES}" "${NL}"
|
||||
printf "%b❌ Script Runtime : %s %b%b" "${RED}" "${SECONDS}" "${RES}" "${NL}"
|
||||
printf "%b❌ Arguments Counter : %s %b%b" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}"
|
||||
printf "%b❌ Arguments Original : %s %b%b" "${RED}" "${VAR_PARAM_STRNG}" "${RES}" "${NL}"
|
||||
printf "%b❌ Arguments Sanitized : %s %b%b" "${RED}" "${VAR_ARG_SANITIZED}" "${RES}" "${NL}"
|
||||
printf "%b❌ Error Log saved at : %s %b%b" "${RED}" "${LOG_ERR}" "${RES}" "${NL}"
|
||||
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_ERR}" "${RES}" "${NL}"
|
||||
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then
|
||||
printf "%b❌ Vars Dump saved at : %s %b%b" "${RED}" "${LOG_VAR}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Vars Dump saved at : %s %b%b" "${RED}" "${LOG_VAR}" "${RES}" "${NL}"
|
||||
fi
|
||||
if [[ "${VAR_DEBUG_TRAP}" == "true" ]]; then
|
||||
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
|
||||
printf "%b❌ Debug Log saved at : %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}"
|
||||
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}"
|
||||
fi
|
||||
if [[ "${VAR_DEBUG_TRACE}" == "true" ]]; then
|
||||
printf "%b❌ Trace Log saved at : %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Trace Log saved at : %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}"
|
||||
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}"
|
||||
fi
|
||||
print_stacktrace
|
||||
printf "%b" "${NL}"
|
||||
|
||||
@@ -134,37 +134,37 @@ trap_exit_non_zero() {
|
||||
gauge ) dialog_gauge_cleaner ;;
|
||||
esac
|
||||
clean_up "${var_code}"
|
||||
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_REL}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Version : %s %b%b" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Epoch : %s %b%b" "${RED}" "${EPOCHREALTIME}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash MAJ Release : %s %b%b" "${RED}" "${BASH_VERSINFO[0]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash MIN Version : %s %b%b" "${RED}" "${BASH_VERSINFO[1]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Bash Patch Level : %s %b%b" "${RED}" "${BASH_VERSINFO[2]}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ UID : %s %b%b" "${RED}" "${UID}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ EUID : %s %b%b" "${RED}" "${EUID}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Hostname : %s %b%b" "${RED}" "${HOSTNAME}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Hostsystem : %s %b%b" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Error : %s %b%b" "${RED}" "${var_code}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Line : %s %b%b" "${RED}" "${var_line}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Script : %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
|
||||
printf "%b❌ CISS.debian.installer Script failed. This was most probably caused by an unbound variable. %b%b" "${RED}" "${RES}" "${NL}"
|
||||
printf "%b❌ GIT Commit : %s %b%b" "${RED}" "${VAR_GIT_REL}" "${RES}" "${NL}"
|
||||
printf "%b❌ Version : %s %b%b" "${RED}" "${VAR_VERSION}" "${RES}" "${NL}"
|
||||
printf "%b❌ Epoch : %s %b%b" "${RED}" "${EPOCHREALTIME}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash MAJ Release : %s %b%b" "${RED}" "${BASH_VERSINFO[0]}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash MIN Version : %s %b%b" "${RED}" "${BASH_VERSINFO[1]}" "${RES}" "${NL}"
|
||||
printf "%b❌ Bash Patch Level : %s %b%b" "${RED}" "${BASH_VERSINFO[2]}" "${RES}" "${NL}"
|
||||
printf "%b❌ UID : %s %b%b" "${RED}" "${UID}" "${RES}" "${NL}"
|
||||
printf "%b❌ EUID : %s %b%b" "${RED}" "${EUID}" "${RES}" "${NL}"
|
||||
printf "%b❌ Hostname : %s %b%b" "${RED}" "${HOSTNAME}" "${RES}" "${NL}"
|
||||
printf "%b❌ Hostsystem : %s %b%b" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}"
|
||||
printf "%b❌ Error : %s %b%b" "${RED}" "${var_code}" "${RES}" "${NL}"
|
||||
printf "%b❌ Line : %s %b%b" "${RED}" "${var_line}" "${RES}" "${NL}"
|
||||
printf "%b❌ Script : %s %b%b" "${RED}" "${var_scrt}" "${RES}" "${NL}"
|
||||
printf "%b❌ Function : %s %b%b" "${RED}" "${var_func}" "${RES}" "${NL}"
|
||||
printf "%b❌ Command : %s %b%b" "${RED}" "${var_cmmd}" "${RES}" "${NL}"
|
||||
printf "%b❌ Script PID : %s %b%b" "${RED}" "${$}" "${RES}" "${NL}"
|
||||
printf "%b❌ Script Runtime : %s %b%b" "${RED}" "${SECONDS}" "${RES}" "${NL}"
|
||||
printf "%b❌ Arguments Counter : %s %b%b" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}"
|
||||
printf "%b❌ Arguments Original : %s %b%b" "${RED}" "${VAR_PARAM_STRNG}" "${RES}" "${NL}"
|
||||
printf "%b❌ Arguments Sanitized : %s %b%b" "${RED}" "${VAR_ARG_SANITIZED}" "${RES}" "${NL}"
|
||||
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then
|
||||
printf "%b❌ Vars Dump saved at : %s %b%b" "${RED}" "${LOG_VAR}" "${RES}" "${NL}" >&2
|
||||
printf "%b❌ Vars Dump saved at : %s %b%b" "${RED}" "${LOG_VAR}" "${RES}" "${NL}"
|
||||
fi
|
||||
if [[ "${VAR_DEBUG_TRAP}" == "true" ]]; then
|
||||
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
|
||||
printf "%b❌ Debug Log saved at : %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}"
|
||||
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_DBG}" "${RES}" "${NL}"
|
||||
fi
|
||||
if [[ "${VAR_DEBUG_TRACE}" == "true" ]]; then
|
||||
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
|
||||
printf "%b❌ Debug Log saved at : %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}"
|
||||
printf "%b❌ cat %s %b%b" "${RED}" "${LOG_TRC}" "${RES}" "${NL}"
|
||||
fi
|
||||
print_stacktrace
|
||||
fi
|
||||
|
||||
@@ -52,7 +52,7 @@ read_password_file() {
|
||||
declare -a lines=()
|
||||
|
||||
### No tracing for security reasons
|
||||
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set +x
|
||||
[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set +x
|
||||
if [[ ! -f "${var_input_file}" ]]; then
|
||||
do_log "fatal" "file_only" "Password file '${var_input_file}' not found."
|
||||
return "${ERR_READ_PASS_FILE}"
|
||||
@@ -76,7 +76,7 @@ read_password_file() {
|
||||
fi
|
||||
|
||||
### Turn on tracing again
|
||||
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
|
||||
[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
|
||||
|
||||
unset lines
|
||||
return 0
|
||||
|
||||
@@ -30,22 +30,22 @@ nuke_passphrase() {
|
||||
declare var_temp_nuke_hash="" var_temp_plain_nuke_pwd="" var_salt=""
|
||||
|
||||
### No tracing for security reasons
|
||||
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set +x
|
||||
[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set +x
|
||||
if ! read_password_file "${var_nuke_pwd_file}" var_temp_plain_nuke_pwd; then
|
||||
return "${ERR_READ_NUKE_FILE}"
|
||||
fi
|
||||
### Turn on tracing again
|
||||
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
|
||||
[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
|
||||
|
||||
if ! var_salt="$(generate_salt)"; then
|
||||
return "${ERR_GENERATE_SALT}"
|
||||
fi
|
||||
|
||||
### No tracing for security reasons
|
||||
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set +x
|
||||
[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set +x
|
||||
var_temp_nuke_hash=$(mkpasswd --method=sha-512 --salt="${var_salt}" --rounds=8388608 "${var_temp_plain_nuke_pwd}")
|
||||
### Turn on tracing again
|
||||
#[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
|
||||
[[ "${VAR_DEBUG_TRACE,,}" == "true" ]] && set -x
|
||||
|
||||
declare -grx VAR_NUKE_HASH="${var_temp_nuke_hash}"
|
||||
unset var_temp_nuke_hash var_temp_plain_nuke_pwd
|
||||
|
||||
Reference in New Issue
Block a user