Files
gourichon_org/tools/dependency_check.sh
Stephane Gourichon 9efff2d36e Check for dependencies.
2025-09-05 22:55:44 +02:00

43 lines
867 B
Bash
Executable File

#!/bin/bash
set -eu
# List of entries: "executable[:package]"
entries=(
"podman"
"podman-compose"
"dig:bind9-dnsutils"
)
missing_packages=()
echo "Checking required executables..."
for entry in "${entries[@]}"; do
IFS=":" read -r cmd pkg <<< "$entry"
# If pkg is empty (no colon found), default package name to executable name
if [ -z "$pkg" ]; then
pkg="$cmd"
fi
if [ -x "$(command -v "$cmd")" ]; then
echo "[FOUND] Executable '$cmd' found."
else
echo "[MISSING] Executable '$cmd' NOT found."
missing_packages+=("$pkg")
fi
done
echo
if [ ${#missing_packages[@]} -eq 0 ]; then
echo "All executables found."
else
echo >&2 "Missing ${#missing_packages[@]} executables."
echo >&2 "Suggested command to install missing packages:"
echo >&2 "sudo apt install --no-install-recommends ${missing_packages[*]}"
exit 1
fi