106 lines
3.2 KiB
Bash
106 lines
3.2 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
|
|
|
|
#######################################
|
|
# Check and set up the minimum required tools for the next installation steps.
|
|
# Every 'apt-get install' command is invoked by adding 'export INITRD=No'
|
|
# to suppress the 'update-initramfs'-Kernel-Hooks, according to the initramfs-tools manpage:
|
|
# https://manpages.debian.org/testing/initramfs-tools-core/initramfs-tools.7.en.html
|
|
# Globals:
|
|
# RECOVERY
|
|
# Arguments:
|
|
# None
|
|
# Returns:
|
|
# 0: on success
|
|
#######################################
|
|
installation_toolset_reco() {
|
|
### Declare Arrays, HashMaps, and Variables.
|
|
# shellcheck disable=SC2154
|
|
declare -A hmp_tool_pkg=(
|
|
[apt-show-versions]="apt-show-versions"
|
|
[bc]="bc"
|
|
[dig]="bind9-dnsutils"
|
|
[host]="bind9-dnsutils"
|
|
[hexdump]="bsdmainutils"
|
|
[btrfs]="btrfs-progs"
|
|
[bunzip2]="bzip2"
|
|
[setupcon]="console-setup"
|
|
[curl]="curl"
|
|
[dirmngr]="dirmngr"
|
|
[dmsetup]="dmsetup"
|
|
[fsck.vfat]="dosfstools"
|
|
[mkfs.vfat]="dosfstools"
|
|
[e2label]="e2fsprogs"
|
|
[tune2fs]="e2fsprogs"
|
|
[fsck]="e2fsprogs"
|
|
[efibootmgr]="efibootmgr"
|
|
[file]="file"
|
|
[awk]="gawk"
|
|
[gdisk]="gdisk"
|
|
[gnupg]="gnupg"
|
|
[haveged]="haveged"
|
|
[update-initramfs]="initramfs-tools"
|
|
[jq]="jq"
|
|
[loadkeys]="kbd"
|
|
[setfont]="kbd"
|
|
[keyctl]="keyutils"
|
|
[libpam-pwquality]="libpam-pwquality"
|
|
[lsb_release]="lsb-release"
|
|
[parted]="parted"
|
|
[lspci]="pciutils"
|
|
[pwgen]="pwgen"
|
|
[sudo]="sudo"
|
|
[tree]="tree"
|
|
[unzip]="unzip"
|
|
[lsusb]="usbutils"
|
|
[xxd]="vim-common"
|
|
[wget]="wget"
|
|
[whois]="whois"
|
|
[zsh]="zsh"
|
|
)
|
|
|
|
declare -a ary_missing_pkgs=() ary_unique_pkgs=()
|
|
declare -r var_logfile="/root/.ciss/cdi/log/5130_installation_toolset.log"
|
|
declare var_bin=""
|
|
|
|
chroot_logger "${RECOVERY}${var_logfile}"
|
|
|
|
### Collecting missing binaries.
|
|
for var_bin in "${!hmp_tool_pkg[@]}"; do
|
|
|
|
if ! chroot_script "${RECOVERY}" "command -v ${var_bin} >/dev/null" "debug"; then
|
|
ary_missing_pkgs+=("${hmp_tool_pkg[${var_bin}]}")
|
|
fi
|
|
|
|
done
|
|
do_log "debug" "file_only" "5130() [ary_missing_pkgs]='${ary_missing_pkgs[*]}'."
|
|
|
|
### 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" "5130() [ary_unique_pkgs]='${ary_unique_pkgs[*]}'."
|
|
|
|
chroot_script "${RECOVERY}" "
|
|
export INITRD=No
|
|
apt-get install -y --no-install-recommends --no-install-suggests ${ary_unique_pkgs[*]} 2>&1 | tee -a ${var_logfile}
|
|
"
|
|
|
|
fi
|
|
|
|
guard_dir && return 0
|
|
}
|
|
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|