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:
@@ -15,9 +15,12 @@ guard_sourcing
|
||||
#######################################
|
||||
# Check for required deb packages to run the script.
|
||||
# Globals:
|
||||
# DIR_LOG
|
||||
# VAR_AUTO_INSTALL
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# 0: on success
|
||||
#######################################
|
||||
check_pkgs() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
@@ -37,29 +40,22 @@ check_pkgs() {
|
||||
[file]="file"
|
||||
[awk]="gawk"
|
||||
[gdisk]="gdisk"
|
||||
[grep]="grep"
|
||||
[gzip]="gzip"
|
||||
[ip]="iproute2"
|
||||
[ping]="iputils-ping"
|
||||
[jq]="jq"
|
||||
[lsb_release]="lsb-release"
|
||||
[parted]="parted"
|
||||
[chpasswd]="passwd"
|
||||
[chsh]="passwd"
|
||||
[pwgen]="pwgen"
|
||||
[sed]="sed"
|
||||
[tar]="tar"
|
||||
[tree]="tree"
|
||||
[unzip]="unzip"
|
||||
[blkid]="util-linux"
|
||||
[wget]="wget"
|
||||
[whois]="whois"
|
||||
[zsh]="zsh"
|
||||
[zstd]="zstd"
|
||||
)
|
||||
declare -a ary_missing_pkgs=() ary_unique_pkgs=()
|
||||
declare var_bin=""
|
||||
|
||||
touch "${DIR_LOG}/0030_check_pkgs.log"
|
||||
|
||||
### Collecting missing binaries.
|
||||
for var_bin in "${!hmp_tool_pkg[@]}"; do
|
||||
|
||||
@@ -79,7 +75,8 @@ check_pkgs() {
|
||||
# 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[*]}" >| "${DIR_LOG}/0030_check_pkgs.log"
|
||||
# shellcheck disable=SC2312
|
||||
apt-get install -y --no-install-recommends --no-install-suggests "${ary_unique_pkgs[*]}" 2>&1 | tee -a "${DIR_LOG}/0030_check_pkgs.log"
|
||||
|
||||
fi
|
||||
|
||||
@@ -87,14 +84,17 @@ check_pkgs() {
|
||||
if grep -RqsE '^[[:space:]]*deb .*backports' /etc/apt/sources.list /etc/apt/sources.list.d; then
|
||||
# shellcheck disable=SC2155
|
||||
declare codename=$(lsb_release -sc)
|
||||
apt-get install -y -t "${codename}-backports" debootstrap >> "${DIR_LOG}/0030_check_pkgs.log"
|
||||
# shellcheck disable=SC2312
|
||||
apt-get install -y -t "${codename}-backports" debootstrap 2>&1 | tee -a "${DIR_LOG}/0030_check_pkgs.log"
|
||||
else
|
||||
apt-get install -y debootstrap >> "${DIR_LOG}/0030_check_pkgs.log"
|
||||
# shellcheck disable=SC2312
|
||||
apt-get install -y debootstrap 2>&1 | tee -a "${DIR_LOG}/0030_check_pkgs.log"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$(command -v dialog || true)" ]]; then
|
||||
if ! "${VAR_AUTO_INSTALL}"; then apt-get install -y --no-install-recommends dialog >> "${DIR_LOG}/0030_check_pkgs.log"; fi
|
||||
# shellcheck disable=SC2312
|
||||
if ! "${VAR_AUTO_INSTALL}"; then apt-get install -y --no-install-recommends dialog 2>&1 | tee -a "${DIR_LOG}/0030_check_pkgs.log"; fi
|
||||
fi
|
||||
|
||||
guard_dir && return 0
|
||||
|
||||
Reference in New Issue
Block a user