make_chroot: Add workspace support.

In certain circumstances the workspace folder has user/group ownership
that doesn't carry properly into the chroot. This CL makes sure that if
a workspace is specified, the chroot user is added to the group that
owns the workspace.

It also changes the chroot primary group to match the primary group
outside the chroot; previously it was hardcoded to eng/5000.

BUG=brillo:861
TEST=mkdir workspace
     sudo chgrp google workspace
     cd workspace
     touch workspace-config.json
     brillo sdk --update <version>
     brillo chroot
     "google" group now exists in the chroot and contains the user.
CQ-DEPEND=CL:269530

Change-Id: I9b47c133b4b86412af55143375c774b96416d495
Reviewed-on: https://chromium-review.googlesource.com/269521
Reviewed-by: David Pursell <dpursell@chromium.org>
Commit-Queue: David Pursell <dpursell@chromium.org>
Trybot-Ready: David Pursell <dpursell@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
1 file changed