V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 53s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 53s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -13,54 +13,64 @@
|
||||
guard_sourcing
|
||||
|
||||
#######################################
|
||||
# Check for required Deb Packages to run the script.
|
||||
# Check for required deb packages to run the script.
|
||||
# Globals:
|
||||
# VAR_AUTO_INSTALL
|
||||
# Arguments:
|
||||
# None
|
||||
#######################################
|
||||
check_pkgs() {
|
||||
apt-get update -y > /dev/null 2>&1
|
||||
|
||||
# TODO: Only activate in case CISS.debian.live.builder does not include the following packages as per default.
|
||||
### Define HashMap: command -> package
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
# shellcheck disable=SC2154
|
||||
#declare -A hmp_command_packages=(
|
||||
# [apt-transport-https]=apt-transport-https
|
||||
# [bzip2]=bzip2
|
||||
# [ca-certificates]=ca-certificates
|
||||
# [curl]=curl
|
||||
# [expect]=expect
|
||||
# [fdisk]=fdisk
|
||||
# [gdisk]=gdisk
|
||||
# [git]=git
|
||||
# [gpg]=gnupg
|
||||
# [lsb_release]=lsb-release
|
||||
# [mkfs.btrfs]=btrfs-progs
|
||||
# [mkfs.ext4]=e2fsprogs
|
||||
# [mkfs.fat]=dosfstools
|
||||
# [mkswap]=util-linux
|
||||
# [mkfs.xfs]=xfsprogs
|
||||
# [parted]=parted
|
||||
# [pwgen]=pwgen
|
||||
# [tar]=tar
|
||||
# [wget]=wget
|
||||
# [whois]=whois
|
||||
# [xz]=xz-utils
|
||||
# [yq]=yq
|
||||
#)
|
||||
declare -A hmp_command_packages=(
|
||||
[apt-transport-https]=apt-transport-https
|
||||
[bzip2]=bzip2
|
||||
[ca-certificates]=ca-certificates
|
||||
[curl]=curl
|
||||
[expect]=expect
|
||||
[fdisk]=fdisk
|
||||
[gdisk]=gdisk
|
||||
[git]=git
|
||||
[gpg]=gnupg
|
||||
[lsb_release]=lsb-release
|
||||
[mkfs.btrfs]=btrfs-progs
|
||||
[mkfs.ext4]=e2fsprogs
|
||||
[mkfs.fat]=dosfstools
|
||||
[mkswap]=util-linux
|
||||
[mkfs.xfs]=xfsprogs
|
||||
[parted]=parted
|
||||
[pwgen]=pwgen
|
||||
[tar]=tar
|
||||
[wget]=wget
|
||||
[whois]=whois
|
||||
[xz]=xz-utils
|
||||
[yq]=yq
|
||||
)
|
||||
declare -a ary_missing_pkgs=() ary_unique_pkgs=()
|
||||
declare var_cmd=""
|
||||
|
||||
### Iterate over HashMap
|
||||
#declare var_cmd var_pkg
|
||||
#for var_cmd in "${!hmp_command_packages[@]}"; do
|
||||
# var_pkg="${hmp_command_packages[${var_cmd}]}"
|
||||
# if ! command -v "${var_cmd}" &>/dev/null; then
|
||||
# apt-get install -y --no-install-recommends "${var_pkg}"
|
||||
# do_log "info" "file_only" "Installing ${var_pkg} done."
|
||||
# else
|
||||
# do_log "info" "file_only" "${var_cmd} already installed."
|
||||
# fi
|
||||
#done
|
||||
### Collecting missing binaries.
|
||||
for var_cmd in "${!hmp_command_packages[@]}"; do
|
||||
|
||||
if ! command -v "${var_cmd}" &>/dev/null; then
|
||||
|
||||
ary_missing_pkgs+=("${hmp_command_packages[${var_cmd}]}")
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
do_log "debug" "file_only" "0030() [ary_missing_pkgs]='${ary_missing_pkgs[*]}'."
|
||||
|
||||
### Installing unique list of packages.
|
||||
apt-get update > /dev/null 2>&1
|
||||
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" "0030() [ary_unique_pkgs]='${ary_unique_pkgs[*]}'."
|
||||
apt-get install -y --no-install-recommends --no-install-suggests "${ary_unique_pkgs[*]}" 2>&1
|
||||
|
||||
fi
|
||||
|
||||
if [[ -z "$(command -v debootstrap || true)" ]]; then
|
||||
if grep -RqsE '^[[:space:]]*deb .*backports' /etc/apt/sources.list /etc/apt/sources.list.d; then
|
||||
@@ -76,6 +86,6 @@ check_pkgs() {
|
||||
if ! "${VAR_AUTO_INSTALL}"; then apt-get install -y --no-install-recommends dialog; fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
guard_dir && return 0
|
||||
}
|
||||
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
|
||||
|
||||
Reference in New Issue
Block a user