Fix setting of PORTAGE_USERNAME.

PORTAGE_USERNAME was being set to "$USER" instead of $USER, causing Portage
to think that the specified username doesn't exist. This causes
/var/cache/edb to be created with the wrong permissions.

Also add PORTAGE_USERNAME to sudoers so that it persists even if a user
or script runs 'sudo emerge'.

BUG=chromium-os:15234
TEST=Verify chroot is now created with correct permissions.

Reviewed-on: http://gerrit.chromium.org/gerrit/742
Reviewed-by: Jim Hebert <jimhebert@chromium.org>
Tested-by: David James <davidjames@chromium.org>
(cherry picked from commit b3a2362551525912a9c81e9f1286f05a03a337de)

Use arrays to pass variables around in make_chroot.

It turns out that bash expects arrays to be quoted differently from strings.
Oops.

BUG=chromium-os:15251
TEST=Test that CROS_WORKON_SRCROOT is set properly and so is PORTAGE_USERNAME.
     Test that cases with spaces in paths are also handled properly (even
     though those should never happen.)

Reviewed-on: http://gerrit.chromium.org/gerrit/799
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: David James <davidjames@chromium.org>
(cherry picked from commit 3cf69fdb1ea74b20e8f6a7764e9053e3f16805cb)

Change-Id: I187a48e6d9c19fd64139c019e879ea823cc726ca
Reviewed-on: http://gerrit.chromium.org/gerrit/777
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: David James <davidjames@chromium.org>
1 file changed