1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-26 18:03:27 +04:00
rCore/docker/entrypoint.sh

20 lines
513 B
Bash
Raw Normal View History

2018-04-02 11:28:32 +04:00
#!/bin/sh
USER_NAME=blogos
USER_UID=${LOCAL_UID:-9001}
USER_GID=${LOCAL_GID:-9001}
groupadd --non-unique --gid $USER_GID $USER_NAME
useradd --non-unique --create-home --uid $USER_UID --gid $USER_GID $USER_NAME
export HOME=/home/$USER_NAME
TESTFILE=$RUSTUP_HOME/settings.toml
CACHED_UID=$(stat -c "%u" $TESTFILE)
CACHED_GID=$(stat -c "%g" $TESTFILE)
if [ $CACHED_UID != $USER_UID ] || [ $USER_GID != $CACHED_GID ]; then
chown $USER_UID:$USER_GID -R $CARGO_HOME $RUSTUP_HOME
fi
exec gosu $USER_NAME "$@"