From 3c9d2f975d2aaa7f39e5c65d5a9a08acbd28f033 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 20 May 2026 16:31:28 +0200 Subject: [PATCH] bootstrap.sh: require python3 + PyYAML (used by homelab CLI) The homelab CLI imports yaml; missing on a fresh LXC. Preflight now checks and emits the right install hint per OS. Co-Authored-By: Claude Opus 4.7 (1M context) --- bootstrap.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 12a7f94..a3ccffe 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -103,16 +103,28 @@ echo "[bootstrap] hostname: $HNAME" # Check dependencies. missing=() -for cmd in git; do command -v "$cmd" >/dev/null || missing+=("$cmd"); done +for cmd in git python3; do command -v "$cmd" >/dev/null || missing+=("$cmd"); done +# The homelab CLI needs PyYAML. +if ! python3 -c "import yaml" >/dev/null 2>&1; then + missing+=("python3-yaml") +fi if [ "$NO_SECRETS" -eq 0 ]; then for cmd in age sops; do command -v "$cmd" >/dev/null || missing+=("$cmd"); done fi if [ "${#missing[@]}" -gt 0 ]; then echo "missing required tools: ${missing[*]}" >&2 if [ "$OS" = "Darwin" ]; then - echo " brew install ${missing[*]}" + # Translate Debian package names to brew/pip equivalents. + brew_list=() + for m in "${missing[@]}"; do + case "$m" in + python3-yaml) echo " pip3 install pyyaml (or brew install pyyaml)" >&2 ;; + *) brew_list+=("$m") ;; + esac + done + [ "${#brew_list[@]}" -gt 0 ] && echo " brew install ${brew_list[*]}" >&2 else - echo " apt install -y ${missing[*]} (or platform equivalent)" + echo " apt install -y ${missing[*]}" >&2 fi exit 1 fi