Files
computer-playbook/scripts/install/all.sh
T
kevinveenbirkenbachandClaude Opus 4.8 9f8aa6e9b6 refactor(env): SPOT the install scripts and derive the nfs export base from group_vars
INFINITO_PYTHON_INSTALL_SCRIPT and INFINITO_DOCKER_CLI_INSTALL_SCRIPT join the default.env SPOT: the Dockerfile consumes them as required args (:? in the RUN as last defense), all three image builders (compose.yml, build.sh, push.sh) pass them hard-required, the shell consumers read the SPOT via default.env grep and the Makefile via BASH_ENV. INFINITO_SWARM_NFS_EXPORT_BASE is no longer a static default: a new env handler derives it from the deploy SPOT group_vars/all/15_storage.yml, 00_topology greps that file (and the STATE_SUBDIR constant) directly, and the swarm test extras stop restating the group_vars value. Stale hadolint directives are restored and recognised; leftover narration comments in the touched files are dropped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 23:04:40 +02:00

68 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install all runtime dependencies, incremental via a stamp file.
#
# Re-runs the install chain (dev-python bootstrap -> venv -> python -> ansible)
# only when a recipe input is newer than the stamp at build/install.stamp.
# Pass --force (or run `make install-force`) to drop the stamp first.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
cd "${REPO_ROOT}"
# shellcheck source=scripts/meta/env/python.sh
source "${REPO_ROOT}/scripts/meta/env/python.sh"
# shellcheck source=/dev/null
source <(grep -E '^INFINITO_PYTHON_INSTALL_SCRIPT=' "${REPO_ROOT}/default.env")
: "${INFINITO_PYTHON_INSTALL_SCRIPT:?}"
STAMP="build/install.stamp"
DEPS=(
pyproject.toml
requirements/requirements.galaxy.yml
requirements/requirements.git.yml
scripts/install/python.sh
scripts/install/ansible.sh
scripts/install/venv.sh
"${INFINITO_PYTHON_INSTALL_SCRIPT}"
)
if [[ "${1:-}" == "--force" ]]; then
rm -f "${STAMP}"
fi
needs_install=0
if [[ ! -f "${STAMP}" ]]; then
needs_install=1
elif [[ ! -x "${VENV}/bin/python" ]]; then
# Exception: repo copies (docker cp / tar into containers) carry the stamp but not the venv; a stamp without its venv is stale and would silently skip the whole install chain.
echo "[install] stamp present but venv missing at ${VENV}; reinstalling" >&2
needs_install=1
else
for dep in "${DEPS[@]}"; do
if [[ ! -f "${dep}" ]]; then
echo "[install] missing dependency: ${dep}" >&2
exit 1
fi
if [[ "${dep}" -nt "${STAMP}" ]]; then
needs_install=1
break
fi
done
fi
if [[ "${needs_install}" -eq 0 ]]; then
exit 0
fi
bash "${INFINITO_PYTHON_INSTALL_SCRIPT}" ensure
bash scripts/install/venv.sh
bash scripts/install/python.sh
ANSIBLE_COLLECTIONS_DIR="${HOME}/.ansible/collections" bash scripts/install/ansible.sh
stamp_dir="$(dirname "${STAMP}")"
mkdir -p "${stamp_dir}"
chmod 0777 "${stamp_dir}" 2>/dev/null || true
touch "${STAMP}"
chmod 0777 "${STAMP}" 2>/dev/null || true