Files
CISS.debian.live.builder/lib/lib_check_pkgs.sh
Marc S. Weidner e2a3a66565
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m21s
V8.13.384.2025.11.06
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
2025-11-07 08:02:45 +01:00

90 lines
2.3 KiB
Bash

#!/bin/bash
# SPDX-Version: 3.0
# SPDX-CreationInfo: 2025-05-05; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.live.builder.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.live.builder
# SPDX-Security-Contact: security@coresecret.eu
guard_sourcing
#######################################
# Check for required Deb Packages to run the script.
# Globals:
# BASH_SOURCE
# VAR_HANDLER_AUTOBUILD
# Arguments:
# None
# Returns:
# 0: on success
#######################################
check_pkgs() {
printf "\e[95m++++ ++++ ++++ ++++ ++++ ++++ ++ 🧪 %s starting ... \e[0m\n" "${BASH_SOURCE[0]}"
apt-get update -qq > /dev/null 2>&1
apt-get install -y --no-install-recommends gnupg gpgv gpg-agent pinentry-curses pinentry-tty gnupg-utils
if ! command -v lsb_release >/dev/null 2>&1; then
apt-get install -y --no-install-recommends lsb-release
fi
if ! command -v batcat >/dev/null 2>&1; then
apt-get install -y --no-install-recommends bat
fi
if ! command -v debootstrap >/dev/null 2>&1; then
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
else
apt-get install -y debootstrap
fi
fi
if [[ ! -f /usr/share/live/build/VERSION ]]; then
apt-get install -y live-build
fi
if [[ "${VAR_HANDLER_AUTOBUILD}" == "false" ]]; then
if ! command -v dialog >/dev/null 2>&1; then
apt-get install -y --no-install-recommends dialog
fi
fi
if ! command -v mkpasswd >/dev/null 2>&1; then
apt-get install -y --no-install-recommends whois
fi
printf "\e[92m++++ ++++ ++++ ++++ ++++ ++++ ++ ✅ %s successfully applied. \e[0m\n" "${BASH_SOURCE[0]}"
return 0
}
### Prevents accidental 'unset -f'.
# shellcheck disable=SC2034
readonly -f check_pkgs
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh