Use well-known passwd constants if user root

If the intended user is root, use well-known constants for UID, GID,
and home directory, to avoid wrongly using those of the normal user
running this script.

Using -f flag for groupadd, to avoid erroring out if group name
already exists for this user name.

Tested: No longer fails with weird groupadd errors if
run-unit-test-docker.sh command line contains USER="root" setting.

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: Idc6158386ce96a6e2fa97dd0eb56b928f18e7a35
1 file changed