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

Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
2025-07-30 23:32:21 +02:00
parent 67dc83c31f
commit 88854df9d8
3 changed files with 27 additions and 11 deletions

View File

@@ -57,16 +57,18 @@ do_in_target() {
TERM="${TERM}" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
DEBIAN_FRONTEND="noninteractive" \
APT_LISTCHANGES_FRONTEND="none" \
"${ary_chroot_command[@]}"
then
do_log "emergency" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 ${ary_chroot_command[*]}] failed."
do_log "emergency" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none ${ary_chroot_command[*]}] failed."
return "${ERR_CHRT_COMMAND}"
else
do_log "info" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 ${ary_chroot_command[*]}] successful."
do_log "info" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none ${ary_chroot_command[*]}] successful."
return 0
fi
@@ -104,11 +106,13 @@ do_in_target_script() {
TERM="${TERM}" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
DEBIAN_FRONTEND="noninteractive" \
APT_LISTCHANGES_FRONTEND="none" \
/bin/bash -c "${var_chroot_script}"
then
do_log "emergency" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 /bin/bash -c ${var_chroot_script}] failed."
do_log "emergency" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none /bin/bash -c ${var_chroot_script}] failed."
return "${ERR_CHRT_COMMAND}"
# TODO: Test with Dialog Wrapper in interactive mode.
@@ -120,7 +124,7 @@ do_in_target_script() {
else
do_log "info" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 /bin/bash -c ${var_chroot_script}] successful."
do_log "info" "file_only" "1080() Command: [chroot ${var_chroot_target} /usr/bin/env -i HOME=/root PATH=${var_default_path} TERM=${TERM} LANG=C.UTF-8 LC_ALL=C.UTF-8 DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none /bin/bash -c ${var_chroot_script}] successful."
return 0
fi

View File

@@ -66,25 +66,37 @@ minimal_toolset() {
[jq]="jq"
)
declare var_bin=""
declare -a ary_missing_pkgs=() ary_unique_pkgs=()
declare var_bin="" var_bin=""
### Installation most basic packages.
do_in_target "${TARGET}" apt-get install -y --no-install-recommends locales tzdata debconf
### Collecting missing binaries.
for var_bin in "${!hmp_tool_pkg[@]}"; do
if ! do_in_target_script "${TARGET}" "command -v ${var_bin} >/dev/null"; then
do_in_target "${TARGET}" apt-get install -y "${hmp_tool_pkg[${var_bin}]}"
ary_missing_pkgs+=("${hmp_tool_pkg[${var_bin}]}")
fi
done
do_log "debug" "file_only" "4090() [ary_missing_pkgs]='${ary_missing_pkgs[*]}'."
do_in_target "${TARGET}" apt-get install -y locales tzdata debconf
### Installing unique list of packages
if ((${#ary_missing_pkgs[@]})); then
# shellcheck disable=SC2312
mapfile -t ary_unique_pkgs < <(printf '%s\n' "${ary_missing_pkgs[@]}" | sort -u)
do_log "debug" "file_only" "4090() [ary_unique_pkgs]='${ary_unique_pkgs[*]}'."
do_in_target "${TARGET}" apt-get install -y --no-install-recommends "${ary_unique_pkgs[@]}"
fi
### Ensure systemd and machine-id are in place
if ! do_in_target_script "${TARGET}" "command -v systemctl >/dev/null"; then
do_log "info" "file_only" "4090() 'systemctl' not found — installing 'systemd' and dependencies."
do_in_target "${TARGET}" apt-get install -y systemd systemd-sysv dbus
do_in_target "${TARGET}" apt-get install -y --no-install-recommends systemd systemd-sysv dbus
else

View File

@@ -88,7 +88,7 @@ do_log() {
### Declare variables.
declare log_uniform=""
declare var_color; var_color=$(do_get_log_color "${var_log_level}")
declare var_ts; var_ts="$(date -u '+%Y-%m-%dT%H:%M:%S.%4N%z')"
declare var_ts; var_ts="$(date -u '+%Y-%m-%dT%H:%M:%S.%9N%z')"
case "${var_log_level,,}" in
debug) log_uniform="[DEBUG] ";;