V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 59s
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:
@@ -57,16 +57,18 @@ do_in_target() {
|
|||||||
TERM="${TERM}" \
|
TERM="${TERM}" \
|
||||||
LANG="C.UTF-8" \
|
LANG="C.UTF-8" \
|
||||||
LC_ALL="C.UTF-8" \
|
LC_ALL="C.UTF-8" \
|
||||||
|
DEBIAN_FRONTEND="noninteractive" \
|
||||||
|
APT_LISTCHANGES_FRONTEND="none" \
|
||||||
"${ary_chroot_command[@]}"
|
"${ary_chroot_command[@]}"
|
||||||
|
|
||||||
then
|
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}"
|
return "${ERR_CHRT_COMMAND}"
|
||||||
|
|
||||||
else
|
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
|
return 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@@ -104,11 +106,13 @@ do_in_target_script() {
|
|||||||
TERM="${TERM}" \
|
TERM="${TERM}" \
|
||||||
LANG="C.UTF-8" \
|
LANG="C.UTF-8" \
|
||||||
LC_ALL="C.UTF-8" \
|
LC_ALL="C.UTF-8" \
|
||||||
|
DEBIAN_FRONTEND="noninteractive" \
|
||||||
|
APT_LISTCHANGES_FRONTEND="none" \
|
||||||
/bin/bash -c "${var_chroot_script}"
|
/bin/bash -c "${var_chroot_script}"
|
||||||
|
|
||||||
then
|
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}"
|
return "${ERR_CHRT_COMMAND}"
|
||||||
|
|
||||||
# TODO: Test with Dialog Wrapper in interactive mode.
|
# TODO: Test with Dialog Wrapper in interactive mode.
|
||||||
@@ -120,7 +124,7 @@ do_in_target_script() {
|
|||||||
|
|
||||||
else
|
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
|
return 0
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -66,25 +66,37 @@ minimal_toolset() {
|
|||||||
[jq]="jq"
|
[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
|
for var_bin in "${!hmp_tool_pkg[@]}"; do
|
||||||
|
|
||||||
if ! do_in_target_script "${TARGET}" "command -v ${var_bin} >/dev/null"; then
|
if ! do_in_target_script "${TARGET}" "command -v ${var_bin} >/dev/null"; then
|
||||||
|
ary_missing_pkgs+=("${hmp_tool_pkg[${var_bin}]}")
|
||||||
do_in_target "${TARGET}" apt-get install -y "${hmp_tool_pkg[${var_bin}]}"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
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
|
### Ensure systemd and machine-id are in place
|
||||||
if ! do_in_target_script "${TARGET}" "command -v systemctl >/dev/null"; then
|
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_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
|
else
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ do_log() {
|
|||||||
### Declare variables.
|
### Declare variables.
|
||||||
declare log_uniform=""
|
declare log_uniform=""
|
||||||
declare var_color; var_color=$(do_get_log_color "${var_log_level}")
|
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
|
case "${var_log_level,,}" in
|
||||||
debug) log_uniform="[DEBUG] ";;
|
debug) log_uniform="[DEBUG] ";;
|
||||||
|
|||||||
Reference in New Issue
Block a user