mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-11-14 09:14:14 +00:00
19 lines
521 B
Bash
19 lines
521 B
Bash
|
#!/bin/bash -e
|
||
|
USERID=${USERID:=0}
|
||
|
|
||
|
## Configure user with a different USERID if requested.
|
||
|
if [ "$USERID" -ne 0 ]
|
||
|
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/config
|
||
|
|
||
|
# Run CMD as different user
|
||
|
exec chroot --userspec="$USERID" --skip-chdir / env HOME=/openedx "$@"
|
||
|
else
|
||
|
# Run CMD as root (business as usual)
|
||
|
exec "$@"
|
||
|
fi
|