V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 43s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 43s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -106,7 +106,7 @@ pre_scan_debug "$@"
|
|||||||
for arg in "$@"; do case "${arg,,}" in -a|--autoinstall) declare -gx VAR_AUTO_INSTALL="true";; esac; done; unset arg
|
for arg in "$@"; do case "${arg,,}" in -a|--autoinstall) declare -gx VAR_AUTO_INSTALL="true";; esac; done; unset arg
|
||||||
|
|
||||||
### ACTIVATING TRAPS
|
### ACTIVATING TRAPS
|
||||||
trap 'trap_exit "$?"' EXIT
|
trap 'trap_exit "$?" "${BASH_SOURCE[0]}" "${LINENO}" "${FUNCNAME[0]:-main}" "${BASH_COMMAND}"' EXIT
|
||||||
trap 'trap_int' INT
|
trap 'trap_int' INT
|
||||||
trap 'trap_err "$?" "${BASH_SOURCE[0]}" "${LINENO}" "${FUNCNAME[0]:-main}" "${BASH_COMMAND}"' ERR
|
trap 'trap_err "$?" "${BASH_SOURCE[0]}" "${LINENO}" "${FUNCNAME[0]:-main}" "${BASH_COMMAND}"' ERR
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ usage() {
|
|||||||
echo " Reset the nice priority value of the script and all its children"
|
echo " Reset the nice priority value of the script and all its children"
|
||||||
echo " to the desired <PRIORITY>. MUST be an integer (between '-19' and 19)."
|
echo " to the desired <PRIORITY>. MUST be an integer (between '-19' and 19)."
|
||||||
echo " Negative (higher) values MUST be enclosed in double quotes '\"'."
|
echo " Negative (higher) values MUST be enclosed in double quotes '\"'."
|
||||||
|
echo " Defaults to '0'."
|
||||||
echo
|
echo
|
||||||
echo -e "\e[97m --reionice-priority <CLASS> <PRIORITY> \e[0m"
|
echo -e "\e[97m --reionice-priority <CLASS> <PRIORITY> \e[0m"
|
||||||
echo " Reset the ionice priority value of the script and all its children"
|
echo " Reset the ionice priority value of the script and all its children"
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ trap_err() {
|
|||||||
declare -g ERRLINE="$3"
|
declare -g ERRLINE="$3"
|
||||||
declare -g ERRFUNC="$4"
|
declare -g ERRFUNC="$4"
|
||||||
declare -g ERRCMMD="$5"
|
declare -g ERRCMMD="$5"
|
||||||
|
ERRTRAP="true"
|
||||||
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then dump_vars_exiting; fi
|
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then dump_vars_exiting; fi
|
||||||
case "${VAR_IN_DIALOG_WR}" in
|
case "${VAR_IN_DIALOG_WR}" in
|
||||||
box ) dialog_box_cleaner ;;
|
box ) dialog_box_cleaner ;;
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ guard_sourcing
|
|||||||
trap_exit() {
|
trap_exit() {
|
||||||
trap - DEBUG ERR EXIT INT
|
trap - DEBUG ERR EXIT INT
|
||||||
declare -r var_trap_on_exit_code="$1"
|
declare -r var_trap_on_exit_code="$1"
|
||||||
|
declare -r var_trap_on_exit_scrt="$2"
|
||||||
|
declare -r var_trap_on_exit_line="$3"
|
||||||
|
declare -r var_trap_on_exit_func="$4"
|
||||||
|
declare -r var_trap_on_exit_cmmd="$5"
|
||||||
|
|
||||||
if [[ -n "${__preexec_invoke:-}" ]]; then
|
if [[ -n "${__preexec_invoke:-}" ]]; then
|
||||||
debug_trap_logger "${var_trap_on_exit_code}" "${VAR_LAST_CMD}"
|
debug_trap_logger "${var_trap_on_exit_code}" "${VAR_LAST_CMD}"
|
||||||
@@ -37,8 +41,19 @@ trap_exit() {
|
|||||||
print_scr_exit "${var_trap_on_exit_code}"
|
print_scr_exit "${var_trap_on_exit_code}"
|
||||||
exit "${var_trap_on_exit_code}"
|
exit "${var_trap_on_exit_code}"
|
||||||
else
|
else
|
||||||
|
if [[ "${ERRTRAP}" == "false" ]]; then
|
||||||
|
if [[ "${VAR_DEBUG_TRACE}" == "true" || "${VAR_DEBUG_TRAP}" == "true" ]]; then dump_vars_exiting; fi
|
||||||
|
case "${VAR_IN_DIALOG_WR}" in
|
||||||
|
box ) dialog_box_cleaner ;;
|
||||||
|
gauge ) dialog_gauge_cleaner ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
clean_up "${var_trap_on_exit_code}"
|
clean_up "${var_trap_on_exit_code}"
|
||||||
print_scr_exit "${var_trap_on_exit_code}"
|
print_scr_exit "${var_trap_on_exit_code}" \
|
||||||
|
"${var_trap_on_exit_scrt}" \
|
||||||
|
"${var_trap_on_exit_line}" \
|
||||||
|
"${var_trap_on_exit_func}" \
|
||||||
|
"${var_trap_on_exit_cmmd}"
|
||||||
exit "${var_trap_on_exit_code}"
|
exit "${var_trap_on_exit_code}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -57,6 +72,10 @@ trap_exit() {
|
|||||||
#######################################
|
#######################################
|
||||||
print_scr_exit() {
|
print_scr_exit() {
|
||||||
declare -r var_print_scr_exit_code="$1"
|
declare -r var_print_scr_exit_code="$1"
|
||||||
|
declare -r var_print_scr_exit_scrt="$2"
|
||||||
|
declare -r var_print_scr_exit_line="$3"
|
||||||
|
declare -r var_print_scr_exit_func="$4"
|
||||||
|
declare -r var_print_scr_exit_cmmd="$5"
|
||||||
if (( var_print_scr_exit_code == 0 )); then
|
if (( var_print_scr_exit_code == 0 )); then
|
||||||
if [[ "${VAR_SCRIPT_SUCCESS}" == "true" ]]; then
|
if [[ "${VAR_SCRIPT_SUCCESS}" == "true" ]]; then
|
||||||
printf "\n"
|
printf "\n"
|
||||||
@@ -80,6 +99,34 @@ print_scr_exit() {
|
|||||||
printf "\e[95m🔗 https://coresecret.eu/spenden/ \e[0m\n"
|
printf "\e[95m🔗 https://coresecret.eu/spenden/ \e[0m\n"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if [[ "${ERRTRAP}" == "false" ]]; then
|
||||||
|
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 "%s❌ Hostsystem : %s %s%s" "${RED}" "${VAR_SYSTEM}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Error : %s %s%s" "${RED}" "${var_print_scr_exit_code}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Line : %s %s%s" "${RED}" "${var_print_scr_exit_line}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Script : %s %s%s" "${RED}" "${var_print_scr_exit_scrt}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Function : %s %s%s" "${RED}" "${var_print_scr_exit_func}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Command : %s %s%s" "${RED}" "${var_print_scr_exit_cmmd}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Script PID : %s %s%s" "${RED}" "${$}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Script Runtime : %s %s%s" "${RED}" "${SECONDS}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Arguments Counter : %s %s%s" "${RED}" "${VAR_PARAM_COUNT}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Arguments Original : %s %s%s" "${RED}" "${ARG_STR_ORG_INPUT}" "${RES}" "${NL}" >&2
|
||||||
|
printf "%s❌ Arguments Sanitized : %s %s%s" "${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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ arg_parser() {
|
|||||||
|
|
||||||
--renice-priority)
|
--renice-priority)
|
||||||
if [[ -n ${2} && ${2} =~ ^-?[0-9]+$ && ${2} -ge -19 && ${2} -le 19 ]]; then
|
if [[ -n ${2} && ${2} =~ ^-?[0-9]+$ && ${2} -ge -19 && ${2} -le 19 ]]; then
|
||||||
declare -gix VAR_PRIORITY="${2}"
|
VAR_PRIORITY="${2}"
|
||||||
shift 2
|
shift 2
|
||||||
else
|
else
|
||||||
arg_mismatch "--renice-priority MUST be an integer between '-19' and '19'."
|
arg_mismatch "--renice-priority MUST be an integer between '-19' and '19'."
|
||||||
@@ -80,12 +80,12 @@ arg_parser() {
|
|||||||
arg_mismatch "--reionice-priority no values provided."
|
arg_mismatch "--reionice-priority no values provided."
|
||||||
else
|
else
|
||||||
if [[ "${2}" =~ ^[1-3]$ ]]; then
|
if [[ "${2}" =~ ^[1-3]$ ]]; then
|
||||||
declare -gix VAR_REIONICE_CLASS="${2}"
|
VAR_REIONICE_CLASS="${2}"
|
||||||
if [[ -z "${3}" ]]; then
|
if [[ -z "${3}" ]]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
if [[ "${3}" =~ ^[0-7]$ ]]; then
|
if [[ "${3}" =~ ^[0-7]$ ]]; then
|
||||||
declare -gix VAR_REIONICE_PRIORITY="${3}"
|
VAR_REIONICE_PRIORITY="${3}"
|
||||||
else
|
else
|
||||||
arg_mismatch "--reionice-priority PRIORITY MUST be an integer between '0' and '7'."
|
arg_mismatch "--reionice-priority PRIORITY MUST be an integer between '0' and '7'."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -53,4 +53,6 @@ declare -gx ERRSCRT="" # = ${BASH_SOURCE[0]} = $2 = ERRSCRT
|
|||||||
declare -gx ERRLINE="" # = ${LINENO} = $3 = ERRLINE
|
declare -gx ERRLINE="" # = ${LINENO} = $3 = ERRLINE
|
||||||
declare -gx ERRFUNC="" # = ${FUNCNAME[0]:-main} = $4 = ERRFUNC
|
declare -gx ERRFUNC="" # = ${FUNCNAME[0]:-main} = $4 = ERRFUNC
|
||||||
declare -gx ERRCMMD="" # = ${$BASH_COMMAND} = $5 = ERRCMMD
|
declare -gx ERRCMMD="" # = ${$BASH_COMMAND} = $5 = ERRCMMD
|
||||||
|
declare -gx ERRTRAP="false" # Check for Trap on 'EXIT' if triggered via Trap on 'ERR'.
|
||||||
|
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
@@ -48,4 +48,9 @@ declare -grx VAR_SAFE_MNT_BASE="/run/ciss/bootstrap"
|
|||||||
### Default log level.
|
### Default log level.
|
||||||
declare -gx VAR_DEFAULT_LOG_LEVEL="info"
|
declare -gx VAR_DEFAULT_LOG_LEVEL="info"
|
||||||
|
|
||||||
|
### Default priority level.
|
||||||
|
declare -gix VAR_PRIORITY=0
|
||||||
|
declare -gix VAR_REIONICE_CLASS=2
|
||||||
|
declare -gix VAR_REIONICE_PRIORITY=4
|
||||||
|
|
||||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||||
|
|||||||
Reference in New Issue
Block a user