mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-11-18 02:55:17 +00:00
6bdc34e560
Closes #20.
20 lines
582 B
Bash
Executable File
20 lines
582 B
Bash
Executable File
#!/bin/bash -e
|
|
export DJANGO_SETTINGS_MODULE=$SERVICE_VARIANT.envs.$SETTINGS
|
|
USERID=${USERID:=1000}
|
|
|
|
## Configure user with a different USERID if requested.
|
|
if [ "$USERID" -ne 1000 ]
|
|
then
|
|
echo "creating new user 'openedx' with UID $USERID"
|
|
useradd --home-dir /openedx -u $USERID openedx
|
|
|
|
# Change file permissions
|
|
chown --no-dereference -R openedx /openedx
|
|
|
|
# Run CMD as different user
|
|
exec chroot --userspec="$USERID" --skip-chdir / env HOME=/openedx "$@"
|
|
else
|
|
# Run CMD as root (business as usual)
|
|
exec "$@"
|
|
fi
|