#!/usr/bin/env bash # Drops from root (needed to read the prebuilt toolchain under /opt) to a # user matching the host's UID/GID, so anything written into the # bind-mounted repo (engine/build_ext, engine/.build-output, ...) is owned # by the host user instead of root. set -euo pipefail USER_UID="${HOST_UID:-1000}" USER_GID="${HOST_GID:-1000}" groupadd -g "$USER_GID" builder 2>/dev/null || true useradd -u "$USER_UID" -g "$USER_GID" -m -s /bin/bash builder 2>/dev/null || true exec gosu builder "$@"