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) <noreply@anthropic.com>
This commit is contained in:
18
bootstrap.sh
18
bootstrap.sh
@@ -103,16 +103,28 @@ echo "[bootstrap] hostname: $HNAME"
|
|||||||
|
|
||||||
# Check dependencies.
|
# Check dependencies.
|
||||||
missing=()
|
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
|
if [ "$NO_SECRETS" -eq 0 ]; then
|
||||||
for cmd in age sops; do command -v "$cmd" >/dev/null || missing+=("$cmd"); done
|
for cmd in age sops; do command -v "$cmd" >/dev/null || missing+=("$cmd"); done
|
||||||
fi
|
fi
|
||||||
if [ "${#missing[@]}" -gt 0 ]; then
|
if [ "${#missing[@]}" -gt 0 ]; then
|
||||||
echo "missing required tools: ${missing[*]}" >&2
|
echo "missing required tools: ${missing[*]}" >&2
|
||||||
if [ "$OS" = "Darwin" ]; then
|
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
|
else
|
||||||
echo " apt install -y ${missing[*]} (or platform equivalent)"
|
echo " apt install -y ${missing[*]}" >&2
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user