fix(bootstrap): sops has no apt/dnf package, fetch the binary directly
Discovered live re-running bootstrap on strong for secrets issuance: apt-get install sops fails outright (no such Debian package — matches what agent-enrollment.md's manual-install recipe already does, fetching the binary from GitHub releases instead of a package manager). dnf would have the same problem. Added install_sops_binary(), used on both the dnf and apt paths; Darwin still installs via brew, which does carry sops. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
32
bootstrap.sh
32
bootstrap.sh
@@ -133,6 +133,22 @@ 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
|
||||||
|
# sops isn't a real Debian/Fedora package (there is no apt/dnf "sops"), so it
|
||||||
|
# always needs the direct-binary-download path, on both distros. Only Darwin
|
||||||
|
# (brew) can install it via a package manager.
|
||||||
|
install_sops_binary() {
|
||||||
|
local sops_version=v3.9.4
|
||||||
|
local arch
|
||||||
|
arch="$(uname -m)"
|
||||||
|
case "$arch" in
|
||||||
|
x86_64|amd64) arch=amd64 ;;
|
||||||
|
aarch64|arm64) arch=arm64 ;;
|
||||||
|
*) echo "[bootstrap] unsupported arch for sops binary download: $arch" >&2; return 1 ;;
|
||||||
|
esac
|
||||||
|
curl -fsSL "https://github.com/getsops/sops/releases/download/${sops_version}/sops-${sops_version}.linux.${arch}" \
|
||||||
|
-o /usr/local/bin/sops && chmod +x /usr/local/bin/sops
|
||||||
|
}
|
||||||
|
|
||||||
if [ "${#missing[@]}" -gt 0 ]; then
|
if [ "${#missing[@]}" -gt 0 ]; then
|
||||||
if [ "$DRY_RUN" -eq 1 ]; then
|
if [ "$DRY_RUN" -eq 1 ]; then
|
||||||
echo "+ would install missing tools: ${missing[*]}"
|
echo "+ would install missing tools: ${missing[*]}"
|
||||||
@@ -153,13 +169,23 @@ if [ "${#missing[@]}" -gt 0 ]; then
|
|||||||
for m in "${missing[@]}"; do
|
for m in "${missing[@]}"; do
|
||||||
case "$m" in
|
case "$m" in
|
||||||
python3-yaml) dnf_list+=("python3-pyyaml") ;;
|
python3-yaml) dnf_list+=("python3-pyyaml") ;;
|
||||||
|
sops) install_sops_binary ;;
|
||||||
*) dnf_list+=("$m") ;;
|
*) dnf_list+=("$m") ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
dnf install -y "${dnf_list[@]}"
|
[ "${#dnf_list[@]}" -gt 0 ] && dnf install -y "${dnf_list[@]}"
|
||||||
elif command -v apt-get >/dev/null 2>&1; then
|
elif command -v apt-get >/dev/null 2>&1; then
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get update
|
apt_list=()
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y "${missing[@]}"
|
for m in "${missing[@]}"; do
|
||||||
|
case "$m" in
|
||||||
|
sops) install_sops_binary ;;
|
||||||
|
*) apt_list+=("$m") ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if [ "${#apt_list[@]}" -gt 0 ]; then
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y "${apt_list[@]}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "[bootstrap] no supported package manager for: ${missing[*]}" >&2
|
echo "[bootstrap] no supported package manager for: ${missing[*]}" >&2
|
||||||
echo "[bootstrap] install with your package manager + re-run" >&2
|
echo "[bootstrap] install with your package manager + re-run" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user