#!/bin/bash
# SPDX-Version: 3.0
# SPDX-CreationInfo: 2025-05-05; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.live.builder.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: LicenseRef-CNCL-1.1 OR LicenseRef-CCLA-1.1
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
# SPDX-PackageName: CISS.debian.live.builder
# SPDX-Security-Contact: security@coresecret.eu

guard_sourcing || return "${ERR_GUARD_SRCE}"

unset BASH_ENV CDPATH ENV GLOBIGNORE

### For all options see https://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
set -o errexit           # Exit script when a command exits with non-zero status, the same as "set -e".
set -o errtrace          # Any traps on ERR are inherited in a subshell environment, the same as "set -E".
set -o functrace         # Any traps on DEBUG and RETURN are inherited in a subshell environment, the same as "set -T".
set -o ignoreeof         # An interactive shell will not exit upon reading EOF.
set -o noclobber         # Prevent overwriting, the same as "set -C".
set -o nounset           # Exit script on use of an undefined variable, the same as "set -u".
set -o pipefail          # Makes pipelines return the exit status of the last command in the pipe that failed.

### For all options see https://www.gnu.org/software/bash/manual/bash.html#The-Shopt-Builtin
shopt -s failglob        # If set, patterns that fail to match filenames during filename expansion result in an expansion error.
shopt -s inherit_errexit # If set, command substitution inherits the value of the errexit option instead of unsetting it in the
                         # subshell environment.
shopt -s lastpipe        # If set, and job control is not active, the shell runs the last command of a pipeline not executed in
                         # the background in the current shell environment.
shopt -u expand_aliases  # If set, aliases are expanded as described. This option is enabled by default for interactive shells.
shopt -u dotglob         # If set, Bash includes filenames beginning with a '.' in the results of filename expansion.
shopt -u extglob         # If set, enable the extended pattern matching features.
shopt -u nullglob        # If set, filename expansion patterns that match no files expand to nothing and are removed.

### Deterministic environment
declare -gx IFS=$' \t\n'
declare -gx LANG=C.UTF-8
declare -gx LC_ALL=C.UTF-8
declare -gx PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
declare -gx TZ=UTC

umask 0022

# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
