#!/bin/bash # SPDX-Version: 3.0 # SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; # 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.; # 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 guard_sourcing || return "${ERR_GUARD_SOURCE}" ### 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. declare -girx ERR_UNBOUND_VARIABLE=252 # Unbound variable. declare -girx ERR_TRAPPED_SIG_INT=251 # The installer detected an INT, which was then confirmed by the user. declare -girx ERR_FLOCK_PROTECTED=250 # The lock file cannot be opened for writing. declare -girx ERR_FLOCK_COLLISION=249 # The script is already running. declare -girx ERR_NO_DOWNLOAD_ARG=248 # 'scurl()' or 'swget()': No arguments specified. declare -girx ERR_DOWNLOAD_FAILED=247 # 'scurl()' or 'swget()': Download failed. declare -girx ERR_NO_VALID_RECIPE=246 # No valid 'recipe' string was found in the partitioning.yaml file. declare -girx ERR_INVALID_IPV4=245 # IPv4 validation failure. declare -girx ERR_INVALID_IPV6=244 # IPv6 validation failure. declare -girx ERR_INVALID_PORT=243 # Port validation failure. declare -girx ERR_ARG_MISMATCH=242 # The wrong number of optional arguments has been provided. declare -girx ERR_PARTITIONTBL=241 # The partition table is not allowed. declare -girx ERR_TABLE_CREATE=240 # The partition table could not be created. declare -girx ERR_TABLE_DELETE=239 # The partition table could not be deleted. declare -girx ERR_PART_CREATE=238 # The partition could not be created. declare -girx ERR_PART_READ=237 # The partition UUID could not be read. declare -girx ERR_BTRFS_INITPH=236 # The btrfs subvolume could not be initialized. declare -girx ERR_BTRFS_SUBVOL=235 # The btrfs subvolume could not be created. declare -girx ERR_BTRFS_OPTION=234 # Compression options algo:level not valid btrfs pairs. declare -girx ERR_MOUNTING_DEV=233 # The Device could not be mounted. declare -girx ERR_MOUNTING_ROOT=232 # The '/' Volume could not be mounted. declare -girx ERR_MOUNTING_LUKS=231 # The LUKS Volume could not be mounted. declare -girx ERR_UNKNOWN_DEV=230 # Unknown Device Path. declare -girx ERR_DEBOOTSTRAP=229 # Failure occurred on the debootstrap. declare -girx ERR_CHRT_MOUNTS=228 # Failure occurred while mounting system devices. declare -girx ERR_CHRT_COMMAND=227 # Failure occurred while executing chroot environment command. declare -girx ERR_GRUB_INSTALL=226 # Error while installing Grub on the specified device. declare -girx ERR_GRUB_BACKGROUND=225 # Failure occurred on setting up the GRUB-background. declare -girx ERR_GRUB_ARCHITECTURE=224 # Architecture is not supported by Grub. declare -girx ERR_PATH_NOT_VALID=223 # A specific path is not existing. declare -girx ERR_READ_NUKE_FILE=222 # Error reading the Luks Nuke password file. declare -girx ERR_READ_GRUB_FILE=221 # Error reading the Grub password file. declare -girx ERR_READ_PASS_FILE=220 # Error reading the password file. declare -girx ERR_GENERATE_SALT=219 # Error generating salt. declare -girx ERR_VAR_REGEX_CHK=218 # Error checking VAR against REGEX. declare -girx ERR_CONF_VALIDATION=217 # Error checking the respective configuration files. declare -girx ERR_CHROOT_LOGGER=216 # An error occurred while preparing the inside chroot log file. declare -girx ERR_READ_SEED_FILE=215 # Error reading the mfa TOTP seed file. declare -girx ERR_VERIFY_VISUDO=214 # Error verification by 'visudo'. declare -girx ERR_VERIFY_LOGROTATE=213 # Error verification by 'logrotate'. declare -girx ERR_READ_AUTH_FILE=212 # Error reading the Luks Backup auth token file. declare -girx ERR_ACCOUNT_CREATE=211 # Error creating user accounts. declare -girx ERR_LUKS_HEADER_ENC=210 # Error encrypting LUKS Header backup. declare -girx ERR_DECRYPTION_SOPS=132 # An error occurred while decrypting SECRETS.yaml. declare -girx ERR_MISSING_AGE_BIN=130 # SOPS binary for decryption SECRETS.yaml missing. declare -girx ERR_MISSING_AGE_KEY=129 # AGE key for decryption SECRETS.yaml values missing. declare -girx ERR_GUARD_SOURCE=128 # Module tried to load twice. ### Definition of error trap vars. declare -gx ERRCODE="" # = $? = $1 = ERRCODE declare -gx ERRSCRT="" # = ${BASH_SOURCE[0]} = $2 = ERRSCRT declare -gx ERRLINE="" # = ${LINENO} = $3 = ERRLINE declare -gx ERRFUNC="" # = ${FUNCNAME[0]:-main} = $4 = ERRFUNC 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