From ab9f7515dd97bf041684445bb33c0d5261e2d93f Mon Sep 17 00:00:00 2001 From: Kyle Manna Date: Fri, 14 Oct 2016 20:15:51 -0700 Subject: [PATCH] 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. --- utils/aosp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/utils/aosp b/utils/aosp index ac157c7..fd892e5 100755 --- a/utils/aosp +++ b/utils/aosp @@ -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"