Files
OpenROAD/etc/docker-entrypoint.sh
Henner Zeller c10380196d Fix uses of /bin/bash to use /usr/bin/env bash instead.
The only Posix compatible way to call bash is via `/usr/bin/env`
as bash might be installed in different locations on the system.
`/bin/bash` is not a Posix-required location for that binary
(only `/bin/sh` is).

Use `set -o noglob` instead of `bash -f` for improved readability.

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2026-03-23 02:57:02 -07:00

22 lines
825 B
Bash
Executable File

#!/usr/bin/env bash
if [ ! -z ${CUSTOM_USER+x} ]; then
if [ -z ${CUSTOM_USER_ID+x} ] || [ -z ${CUSTOM_GROUP_ID+x} ]; then
echo "You need to set CUSTOM_USER_ID and CUSTOM_GROUP_ID"
exit 1
fi
echo "Starting with USER=${CUSTOM_USER} UID=${CUSTOM_USER_ID} GID=${CUSTOM_GROUP_ID}"
groupadd --gid "${CUSTOM_GROUP_ID}" "${CUSTOM_USER}"
useradd --groups sudo -g "${CUSTOM_USER}" \
--uid "${CUSTOM_USER_ID}" \
-m "${CUSTOM_USER}"
chown "${CUSTOM_USER}:${CUSTOM_USER}" -R /OpenROAD
exec setpriv \
--reuid "${CUSTOM_USER_ID}" \
--regid "${CUSTOM_GROUP_ID}" \
--clear-groups \
-- "$@"
else
echo "Starting with default user"
exec "$@"
fi