V9.14.002.2026.06.08
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -23,17 +23,21 @@ guard_sourcing || return "${ERR_GUARD_SOURCE}"
|
||||
# VAR_IN_DIALOG_WR
|
||||
# Arguments:
|
||||
# 1: Message to be printed.
|
||||
# 2: Optional exit code.
|
||||
#######################################
|
||||
arg_mismatch() {
|
||||
declare -i err_code="${2:-${ERR_ARG_MISMATCH}}"
|
||||
|
||||
### Call cleaner if and only if not in auto-install mode.
|
||||
if [[ "${VAR_AUTO_INSTALL}" == "false" ]]; then
|
||||
### Dynamically select the cleaner based on the dialog wrapper type.
|
||||
# shellcheck disable=SC2249
|
||||
case "${VAR_IN_DIALOG_WR}" in
|
||||
box|gauge) "dialog_${VAR_IN_DIALOG_WR}_cleaner" ;;
|
||||
esac
|
||||
fi
|
||||
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}"
|
||||
read -rp $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
|
||||
exit "${err_code}"
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
@@ -17,6 +17,7 @@ guard_sourcing || return "${ERR_GUARD_SOURCE}"
|
||||
# Globals:
|
||||
# VAR_DEFAULT_LOG_LEVEL
|
||||
# VAR_AUTO_INSTALL
|
||||
# VAR_DROPBEAR_VERSION
|
||||
# VAR_IN_DIALOG_WR
|
||||
# VAR_PRIORITY
|
||||
# VAR_REIONICE_CLASS
|
||||
@@ -51,6 +52,24 @@ arg_parser() {
|
||||
shift 1
|
||||
;;
|
||||
|
||||
--dropbear-version)
|
||||
if [[ -n "${2-}" && "${2}" =~ ^[0-9]{4}\.[0-9]+$ ]]; then
|
||||
declare -gx VAR_DROPBEAR_VERSION="${2}"
|
||||
shift 2
|
||||
else
|
||||
arg_mismatch "--dropbear-version MUST match <YYYY>.<NUMBER>." "${ERR_DROPBEAR_V}"
|
||||
fi
|
||||
;;
|
||||
|
||||
--dropbear-version=*)
|
||||
if [[ "${argument#*=}" =~ ^[0-9]{4}\.[0-9]+$ ]]; then
|
||||
declare -gx VAR_DROPBEAR_VERSION="${argument#*=}"
|
||||
shift 1
|
||||
else
|
||||
arg_mismatch "--dropbear-version MUST match <YYYY>.<NUMBER>." "${ERR_DROPBEAR_V}"
|
||||
fi
|
||||
;;
|
||||
|
||||
-l | --log)
|
||||
case "${2,,}" in
|
||||
debug|info|notice|warn|error|critical|fatal|emergency) declare -gx VAR_DEFAULT_LOG_LEVEL="$2"; shift 2 ;;
|
||||
|
||||
Reference in New Issue
Block a user