feat: Implement dependency checking and Git identity validation

This commit is contained in:
Matteo Cherubini 2026-05-08 21:09:41 +02:00
parent 9b4bacabb7
commit 8ebd247084

36
lib/deps.sh Normal file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env bash
# =============================================================================
# lib/deps.sh
# Dependency and environment validation.
# =============================================================================
check_deps() {
local missing=()
local required=(git git-crypt curl jq)
for cmd in "${required[@]}"; do
if ! command -v "$cmd" &>/dev/null; then
missing+=("$cmd")
fi
done
if [[ ${#missing[@]} -gt 0 ]]; then
error "Missing required tools: ${missing[*]}"
echo -e "\nInstall them using your package manager:"
echo " Debian/Ubuntu: sudo apt install ${missing[*]}"
echo " MacOS: brew install ${missing[*]}"
exit 1
fi
success "Environment check passed: all required tools found."
if ! command -v bw &>/dev/null; then
warn "Optional tool 'bw' (Bitwarden CLI) not found. Vaultwarden integration will be manual."
fi
}
check_git_identity() {
if [[ -z "$(git config user.name)" || -z "$(git config user.email)" ]]; then
warn "Git identity not set globally. Scripts will attempt to use local config."
fi
}