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