52 lines
1.8 KiB
Bash
52 lines
1.8 KiB
Bash
#!/bin/bash
|
|
# SPDX-Version: 3.0
|
|
# SPDX-CreationInfo: 2025-06-17; WEIDNER, Marc S.; <msw@coresecret.dev>
|
|
# 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.; <msw@coresecret.dev>
|
|
# 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
|
|
|
|
#######################################
|
|
# Wrapper around 'printf' for clean code.
|
|
# Globals:
|
|
# RES
|
|
# Arguments:
|
|
# 1: One of "${BLA}" | "${RED}" | "${GRE}" | "${YEL}" | "${BLU}" | "${MAG}" | "${CYA}" | "${WHI}"
|
|
# 2: Text string to print on terminal.
|
|
#######################################
|
|
do_print_color() {
|
|
printf "%b\n" "${1}${2}${RES}"
|
|
}
|
|
|
|
#######################################
|
|
# Wrapper around 'printf' for clean, uniform terminal output and line fold for long text strings for better readability.
|
|
# Globals:
|
|
# RES
|
|
# Arguments:
|
|
# 1: One of "${BLA}" | "${RED}" | "${GRE}" | "${YEL}" | "${BLU}" | "${MAG}" | "${CYA}" | "${WHI}"
|
|
# 2: Text string to print on terminal.
|
|
#######################################
|
|
do_print_fold() {
|
|
declare var_color="$1"; shift
|
|
declare var_msg_string="$*"
|
|
declare var_formatted_string="${var_color}${var_msg_string}${RES}"
|
|
# shellcheck disable=SC2312
|
|
printf "%b\n" "${var_formatted_string}" | fold -s -w 76 | sed '1! s/^/ /'
|
|
}
|
|
|
|
#######################################
|
|
# Wrapper around 'printf' for logfile redirect.
|
|
# Arguments:
|
|
# 1: Text string to redirect to a log file.
|
|
#######################################
|
|
do_print_log() {
|
|
printf "%s\n" "${1}"
|
|
}
|
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|