mirror of
https://github.com/kylemanna/docker-aosp
synced 2025-06-07 16:06:17 +00:00
utils/aosp: Only pass UID and GID arguments if NOT root
* Running as root will (among other things) try to re-create the root user in the container. Avoid this by not passing the arguments and letting the container use its defaults.
This commit is contained in:
parent
9e4c52f282
commit
ab9f7515dd
@ -37,8 +37,12 @@ function aosp_create_dir_if_needed {
|
|||||||
aosp_create_dir_if_needed $AOSP_VOL_AOSP
|
aosp_create_dir_if_needed $AOSP_VOL_AOSP
|
||||||
aosp_create_dir_if_needed $AOSP_VOL_CCACHE
|
aosp_create_dir_if_needed $AOSP_VOL_CCACHE
|
||||||
|
|
||||||
# Set uid and gid to match host current user
|
uid=$(id -u)
|
||||||
AOSP_HOST_ID_ARGS="-e USER_ID=$(id -u) -e GROUP_ID=$(id -g)"
|
|
||||||
|
# Set uid and gid to match host current user as long as NOT root
|
||||||
|
if [ $uid -ne "0" ]; then
|
||||||
|
AOSP_HOST_ID_ARGS="-e USER_ID=$uid -e GROUP_ID=$(id -g)"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$SSH_AUTH_SOCK" ]; then
|
if [ -n "$SSH_AUTH_SOCK" ]; then
|
||||||
SSH_AUTH_ARGS="-v $SSH_AUTH_SOCK:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"
|
SSH_AUTH_ARGS="-v $SSH_AUTH_SOCK:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user