[PATCH 6/8] tools/build-docs-container: allow running non-interactively

Antonin Godard
2025-12-22T12:28:41Z

When running this script from another one, it can be useful to run the
OCI run command non-interactively, especially when running concurrent
builds. Add a RUN_NON_INTERACIVE env variable that can be set to 1 to
remove the --interactive and --tty options from the run command.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
documentation/tools/build-docs-container | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/documentation/tools/build-docs-container b/documentation/tools/build-docs-container
index 7f3ba3680..7a5191710 100755
--- a/documentation/tools/build-docs-container
+++ b/documentation/tools/build-docs-container
@@ -24,6 +24,7 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
CONTAINERCMD=${CONTAINERCMD:-docker}
DOCS_DIR="$SCRIPT_DIR/../.."
INCLUDE_ESSENTIAL_PACKAGES=${INCLUDE_ESSENTIAL_PACKAGES:-0}
+RUN_NON_INTERACTIVE="${RUN_NON_INTERACTIVE:-0}"

function usage()
{
@@ -65,6 +66,9 @@ $0 OCI_IMAGE [make arguments...]
packages listed in documentation/tools/host_packages_scripts/*_essential.sh.
This is not required to build the documentation but can be useful to validate
the installation of packages listed in these files (default: 0).
+
+ - RUN_NON_INTERACTIVE: when set to 1, allow the '\$OCI run' command to be run
+ non-interactively, without a tty.
"
}

@@ -177,14 +181,19 @@ main ()

local -a args_run=(
--rm
- --interactive
- --tty
--volume="$DOCS_DIR:/docs:rw"
--workdir=/docs
--security-opt label=disable
--env BUILDDIR="_build/$orig_image-$image_sha"
)

+ if [ "${RUN_NON_INTERACTIVE}" != "1" ]; then
+ args_run+=(
+ --interactive
+ --tty
+ )
+ fi
+
# Create a symlink pointing to the latest build output
mkdir -p "$DOCS_DIR"/documentation/_build
ln -snf "$orig_image-$image_sha" "$DOCS_DIR"/documentation/_build/latest

--
2.51.0