V8.03.912.2025.07.23
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 42s

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-25 00:12:09 +02:00
parent d1a643ef59
commit f415c7aef5
2 changed files with 31 additions and 30 deletions

View File

@@ -65,7 +65,7 @@ arg_parser() {
-c | --contact)
if [[ -n "${2}" && "${2}" != -* ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --contact MUST NOT be followed by an argument.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -75,7 +75,7 @@ arg_parser() {
-h | --help)
if [[ -n "${2}" && "${2}" != -* ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --help MUST NOT be followed by an argument.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -85,7 +85,7 @@ arg_parser() {
-v | --version)
if [[ -n "${2}" && "${2}" != -* ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --version MUST NOT be followed by an argument.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -98,7 +98,7 @@ arg_parser() {
declare -gx VAR_ARCHITECTURE="${2}"
shift 2
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --architecture MUST be 'amd64' or 'arm64'.\e[0m\n" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -109,7 +109,7 @@ arg_parser() {
--build-directory)
declare -gx VAR_HANDLER_BUILD_DIR="${2}"
if [[ ! "${VAR_HANDLER_BUILD_DIR}" =~ ^/ ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --build-directory MUST be an absolute path. Got: '%s'\n" "${VAR_HANDLER_BUILD_DIR}" >&2
exit "${ERR_NOTABSPATH}"
fi
@@ -119,7 +119,7 @@ arg_parser() {
--cdi)
if [[ -n "${2}" && "${2}" != -* ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --cdi MUST NOT be followed by an argument.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -133,7 +133,7 @@ arg_parser() {
declare -g VAR_HANDLER_SPLASH="${2}"
shift 2
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --change-splash MUST be 'club' or 'hexagon'.\e[0m\n" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -146,7 +146,7 @@ arg_parser() {
declare -g VAR_HANDLER_ISO_COUNTER="${2}"
shift 2
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --control MUST be provided with a Parameter.\e[0m\n" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -156,7 +156,7 @@ arg_parser() {
--debug)
if [[ -n "${2}" && "${2}" != -* ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --debug MUST NOT be followed by an argument.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -166,7 +166,7 @@ arg_parser() {
--dhcp-centurion)
if [[ -n "${2}" && "${2}" != -* ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --dhcp-centurion MUST NOT be followed by an argument.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -188,7 +188,7 @@ arg_parser() {
shift
done
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --jump-host MUST contain one or up to ten IPs.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -197,7 +197,7 @@ arg_parser() {
--log-statistics-only)
if [[ -n "${2}" && "${2}" != -* ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --log-statistics-only MUST NOT be followed by an argument.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -221,7 +221,7 @@ arg_parser() {
shift
done
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --provider-netcup-ipv6 MUST provide one IPv6.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_ARG_MSMTCH}"
@@ -230,10 +230,10 @@ arg_parser() {
--renice-priority)
if [[ -n ${2} && ${2} =~ ^-?[0-9]+$ && ${2} -ge -19 && ${2} -le 19 ]]; then
declare -gi VAR_HANDLER_PRIORITY="$2"
VAR_HANDLER_PRIORITY="$2"
shift 2
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --renice-priority MUST an integer between '-19' and '19'.\e[0m\n" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -243,27 +243,27 @@ arg_parser() {
--reionice-priority)
if [[ -z "${2}" ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --reionice-priority no values provided.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_REIONICE_P}"
else
if [[ "${2}" =~ ^[1-3]$ ]]; then
declare -gi VAR_REIONICE_CLASS="${2}"
VAR_REIONICE_CLASS="${2}"
if [[ -z "${3}" ]]; then
:
else
if [[ "${3}" =~ ^[0-7]$ ]]; then
declare -gi VAR_REIONICE_PRIORITY="${3}"
VAR_REIONICE_PRIORITY="${3}"
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --reionice-priority PRIORITY MUST be an integer between '0' and '7'.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_REIO_P_VAL}"
fi
fi
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --reionice-priority CLASS MUST be an integer between '1' and '3'.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR_REIO_C_VAL}"
@@ -279,7 +279,7 @@ arg_parser() {
--root-password-file)
declare pw_file="${2}"
if [[ -z "${pw_file}" ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --root-password-file missing password file path argument.\e[0m\n" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -287,7 +287,7 @@ arg_parser() {
fi
if [[ ! -f "${pw_file}" ]]; then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --root-password-file password file '%s' does not exist.\e[0m\n" "${pw_file}" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -298,7 +298,7 @@ arg_parser() {
owner=$(stat -c '%U:%G' "${pw_file}")
if [[ "${owner}" != "root:root" ]]; then
chown root:root "${pw_file}" || {
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --root-password-file failed to set owner root:root on '%s'.\e[0m\n" "${pw_file}" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -310,7 +310,7 @@ arg_parser() {
perms=$(stat -c '%a' "${pw_file}")
if [[ "${perms}" -ne 400 ]]; then
chmod 400 "${pw_file}" || {
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --root-password-file failed to set permissions 0400 on '%s'.\e[0m\n" "${pw_file}" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -328,7 +328,7 @@ arg_parser() {
declare pw_length
pw_length=${#plaintext_pw}
if (( pw_length < 20 || pw_length > 64 )); then
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --root-password-file password MUST be between 20 and 64 characters (got %d).\e[0m\n" "${pw_length}" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -338,7 +338,7 @@ arg_parser() {
[[ "${VAR_EARLY_DEBUG}" == "true" ]] && set +x # No tracing for security reasons
if [[ "${plaintext_pw}" == *\"* ]]; then
[[ "${VAR_EARLY_DEBUG}" == "true" ]] && set -x # Turn on tracing again
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --root-password-file password MUST NOT contain double quotes (\").\e[0m\n" >&2
# shellcheck disable=SC2162
read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
@@ -378,7 +378,7 @@ arg_parser() {
declare -gi VAR_SSHPORT="${2}"
shift 2
else
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
printf "\e[91m❌ Error: --ssh-port MUST be an integer between '1' and '65535'.\e[0m\n" >&2
read -p -r $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m'
exit "${ERR__SSH__PORT}"
@@ -391,7 +391,7 @@ arg_parser() {
;;
*)
if ! $VAR_HANDLER_AUTOBUILD; then boot_screen_cleaner; fi
if ! ${VAR_HANDLER_AUTOBUILD}; then boot_screen_cleaner; fi
usage
;;
esac

View File

@@ -32,8 +32,9 @@ declare -g VAR_HANDLER_PRIORITY=""
declare -g VAR_HANDLER_NETCUP_IPV6="false"
declare -g VAR_HASHED_PWD=""
declare -gi VAR_HANDLER_STA=0
declare -g VAR_REIONICE_CLASS=""
declare -g VAR_REIONICE_PRIORITY=""
declare -gi VAR_HANDLER_PRIORITY=0
declare -gi VAR_REIONICE_CLASS=2
declare -gi VAR_REIONICE_PRIORITY=4
declare -gr VAR_CHROOT_DIR="chroot"
declare -gr VAR_PACKAGES_FILE="chroot.packages.live"
declare -ga ARY_HANDLER_JUMPHOST=()