#!/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}" ####################################### # Logger for all generated partition, LUKS container and file system UUIDs. # Globals: # HMP_PATH_FSUUID # HMP_PATH_LUKSUUID # HMP_PATH_PARTUUID # LOG_UID # Arguments: # None # Returns: # 0: on success ####################################### uuid_logger() { declare var_key="" var_mountpoint="" var_uuid="" printf 'PARTITION UUID Partition:\n' >> "${LOG_UID}" for var_key in "${!HMP_PATH_PARTUUID[@]}"; do var_mountpoint="${var_key}" var_uuid="${HMP_PATH_PARTUUID[${var_key}]}" ### Left-aligned field width 63; "UUID=" starts directly after column 64. printf '%-63sUUID=%s\n' "${var_mountpoint}" "${var_uuid}" >> "${LOG_UID}" done printf '\n' >> "${LOG_UID}" printf 'LUKS CONTAINER UUID:\n' >> "${LOG_UID}" for var_key in "${!HMP_PATH_LUKSUUID[@]}"; do var_mountpoint="${var_key}" var_uuid="${HMP_PATH_LUKSUUID[${var_key}]}" ### Left-aligned field width 63; "UUID=" starts directly after column 64. printf '%-63sUUID=%s\n' "${var_mountpoint}" "${var_uuid}" >> "${LOG_UID}" done printf '\n' >> "${LOG_UID}" printf 'FILESYSTEM UUID:\n' >> "${LOG_UID}" for var_key in "${!HMP_PATH_FSUUID[@]}"; do var_mountpoint="${var_key}" var_uuid="${HMP_PATH_FSUUID[${var_key}]}" ### Left-aligned field width 63; "UUID=" starts directly after column 64. printf '%-63sUUID=%s\n' "${var_mountpoint}" "${var_uuid}" >> "${LOG_UID}" done guard_dir; return 0 } ### Prevents accidental 'unset -f'. # shellcheck disable=SC2034 readonly -f uuid_logger # vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh