mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 03:38:23 +00:00
scripts/docker/entry.sh's two compile-control reads (INFINITO_COMPILE
and INFINITO_COMPILE_SILENCE) crashed during Dockerfile RUN because
that context has no env-pipeline: env/default.env exists in the repo
but no make/BASH_ENV/load.sh chain materialises it into the running
shell. The bare reads under `set -u` triggered unbound-variable exit
even though the keys were registered in default.env + passthrough.
Move build/silence control from env to script flags so entry.sh is
self-contained at bootstrap time. Each flag now triggers its action
directly inside the parse loop -- no COMPILE/SILENCE state vars:
--compile -> run_local_build (streaming)
--compile-silent -> run_local_build >/dev/null 2>&1
-- -> end flag parsing, rest is the exec target
Drop INFINITO_COMPILE + INFINITO_COMPILE_SILENCE from the whole
registry surface: env/default.env, passthrough.STATIC_KEYS, the
infinito_compile handler (gone entirely), compose.yml's env
injection block, the dotenv-generator baseline test, the
build_env unit-test fixture, and the now-no-op `-e INFINITO_COMPILE=0`
in test-install-{make,pkgmgr} workflows.
Dockerfile RUN switches to `entry.sh --compile -- true`; runtime
ENTRYPOINT receives no flags so the default (no-compile) holds and
exec hands off to systemd via the CMD.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
68 lines
1.9 KiB
Bash
Executable File
68 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
echo "[docker-infinito] Starting infinito container"
|
|
|
|
if [[ "${1:-}" == "/sbin/init" ]]; then
|
|
echo "[docker-infinito] Starting systemd as PID 1..."
|
|
exec /sbin/init
|
|
fi
|
|
|
|
# Compute dynamically if not provided from outside
|
|
echo "[docker-infinito] before pkgmgr path"
|
|
INFINITO_PATH="$(pkgmgr path infinito)"
|
|
echo "[docker-infinito] after pkgmgr path: ${INFINITO_PATH}" # nocheck: container-bootstrap
|
|
|
|
INFINITO_SRC_DIR="/opt/src/infinito"
|
|
export INFINITO_PATH
|
|
export INFINITO_SRC_DIR
|
|
|
|
run_local_build() {
|
|
echo "[docker-infinito] Build enabled (--compile)"
|
|
echo "[docker-infinito] Using ${INFINITO_PATH} as working directory" # nocheck: container-bootstrap
|
|
|
|
mkdir -p "${INFINITO_PATH}" # nocheck: container-bootstrap
|
|
cd "${INFINITO_PATH}" # nocheck: container-bootstrap
|
|
|
|
echo "[docker-infinito] Copy ${INFINITO_SRC_DIR} to ${INFINITO_PATH}..." # nocheck: container-bootstrap
|
|
rsync -a --delete --chown=root:root --exclude='.git' "${INFINITO_SRC_DIR}/" "${INFINITO_PATH}/" # nocheck: container-bootstrap
|
|
|
|
echo "[docker-infinito] Reinstall via 'make install'..."
|
|
make install
|
|
|
|
echo "[docker-infinito] Installed:"
|
|
pkgmgr version infinito
|
|
}
|
|
|
|
# Parse bootstrap flags. Each flag triggers its action directly; `--`
|
|
# terminates flag parsing so the rest of argv is the exec target.
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--compile)
|
|
shift
|
|
run_local_build
|
|
;;
|
|
--compile-silent)
|
|
shift
|
|
run_local_build >/dev/null 2>&1
|
|
;;
|
|
--)
|
|
shift
|
|
break
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Hand off to infinito or arbitrary command
|
|
# ---------------------------------------------------------------------------
|
|
if [[ $# -eq 0 ]]; then
|
|
echo "[docker-infinito] No arguments provided. Showing infinito help..."
|
|
exec infinito --help
|
|
else
|
|
cd "${INFINITO_PATH}" # nocheck: container-bootstrap
|
|
exec "$@"
|
|
fi
|