1
0
mirror of https://github.com/kylemanna/docker-aosp synced 2025-06-06 23:46:18 +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:
Kyle Manna 2016-10-14 20:15:51 -07:00
parent 9e4c52f282
commit ab9f7515dd

View File

@ -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_CCACHE
# Set uid and gid to match host current user
AOSP_HOST_ID_ARGS="-e USER_ID=$(id -u) -e GROUP_ID=$(id -g)"
uid=$(id -u)
# 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
SSH_AUTH_ARGS="-v $SSH_AUTH_SOCK:/tmp/ssh_auth -e SSH_AUTH_SOCK=/tmp/ssh_auth"