V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 54s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
130
func/cdi_4100_base/4130_installation_toolset.sh
Normal file
130
func/cdi_4100_base/4130_installation_toolset.sh
Normal file
@@ -0,0 +1,130 @@
|
||||
#!/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.
|
||||
# Globals:
|
||||
# DIR_LOG
|
||||
# TARGET
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
installation_toolset() {
|
||||
### 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"
|
||||
[busybox]="busybox"
|
||||
[bunzip2]="bzip2"
|
||||
[base64]="coreutils"
|
||||
[cat]="coreutils"
|
||||
[chmod]="coreutils"
|
||||
[chown]="coreutils"
|
||||
[cp]="coreutils"
|
||||
[echo]="coreutils"
|
||||
[ln]="coreutils"
|
||||
[mkdir]="coreutils"
|
||||
[curl]="curl"
|
||||
[dirmngr]="dirmngr"
|
||||
[dmsetup]="dmsetup"
|
||||
[fsck.vfat]="dosfstools"
|
||||
[mkfs.vfat]="dosfstools"
|
||||
[e2label]="e2fsprogs"
|
||||
[tune2fs]="e2fsprogs"
|
||||
[fsck]="e2fsprogs"
|
||||
[efibootmgr]="efibootmgr"
|
||||
[fdisk]="fdisk"
|
||||
[file]="file"
|
||||
[awk]="gawk"
|
||||
[gdisk]="gdisk"
|
||||
[gnupg]="gnupg"
|
||||
[grep]="grep"
|
||||
[gzip]="gzip"
|
||||
[haveged]="haveged"
|
||||
[update-initramfs]="initramfs-tools"
|
||||
[ip]="iproute2"
|
||||
[ping]="iputils-ping"
|
||||
[jq]="jq"
|
||||
[loadkeys]="kbd"
|
||||
[setfont]="kbd"
|
||||
[keyctl]="keyutils"
|
||||
[modprobe]="kmod"
|
||||
[libpam-pwquality]="libpam-pwquality"
|
||||
[logrotate]="logrotate"
|
||||
[lsb_release]="lsb-release"
|
||||
[parted]="parted"
|
||||
[chpasswd]="passwd"
|
||||
[chsh]="passwd"
|
||||
[lspci]="pciutils"
|
||||
[sysctl]="procps"
|
||||
[pwgen]="pwgen"
|
||||
[sed]="sed"
|
||||
[sudo]="sudo"
|
||||
[tar]="tar"
|
||||
[tree]="tree"
|
||||
[unzip]="unzip"
|
||||
[lsusb]="usbutils"
|
||||
[blkid]="util-linux"
|
||||
[dmesg]="util-linux"
|
||||
[lsblk]="util-linux"
|
||||
[findmnt]="util-linux"
|
||||
[mount]="util-linux"
|
||||
[umount]="util-linux"
|
||||
[xxd]="vim-common"
|
||||
[wget]="wget"
|
||||
[whois]="whois"
|
||||
[zsh]="zsh"
|
||||
[zstd]="zstd"
|
||||
)
|
||||
|
||||
declare -a ary_missing_pkgs=() ary_unique_pkgs=()
|
||||
declare -r var_logfile="/root/.ciss/cdi/log/4130_installation_toolset.log"
|
||||
declare var_bin=""
|
||||
|
||||
touch "${TARGET}${var_logfile}" && chmod 0600 "${TARGET}${var_logfile}"
|
||||
|
||||
### Collecting missing binaries.
|
||||
for var_bin in "${!hmp_tool_pkg[@]}"; do
|
||||
|
||||
if ! do_in_target_script "${TARGET}" "command -v ${var_bin} >/dev/null" "debug"; then
|
||||
ary_missing_pkgs+=("${hmp_tool_pkg[${var_bin}]}")
|
||||
fi
|
||||
|
||||
done
|
||||
do_log "debug" "file_only" "4130() [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" "4130() [ary_unique_pkgs]='${ary_unique_pkgs[*]}'."
|
||||
|
||||
do_in_target_script "${TARGET}" "
|
||||
apt-get install -y --no-install-recommends --no-install-suggests ${ary_unique_pkgs[*]} 2>&1 | tee -a ${var_logfile}
|
||||
echo ExitCode: \$? >> ${var_logfile}
|
||||
"
|
||||
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
Reference in New Issue
Block a user