When entering chroot, copy ~/.gdata_cred.txt if it exists.

The process of updating the Portage package status spreadsheet on
buildbots requires a credentials file at ~/.gdata_cred.txt in the
chroot.  All buildbot VMs have this file outside the chroot now,
so this change adds that file to the list of things created in
the user's homedir when entering the chroot.

BUG=None
TEST=Run cros_sdk in these scenarios:
~/.gdata_cred.txt exists -> Same file should be at $HOME in chroot
~/.gdata_cred.txt does not exist -> No file created in chroot

Change-Id: I5c0f333a9308f5efa5324ce2e202a7c9e9fdb48b
Reviewed-on: http://gerrit.chromium.org/gerrit/6911
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Tested-by: Matt Tennant <mtennant@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index e3635e5..8750300 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -307,6 +307,12 @@
       user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \
         sed -e 's/.*<\([^>]*\)>.*/\1/')" || true
 
+    # Copy ~/.gdata_cred.txt to chroot if it exists.  This file contains
+    # credentials for reading/writing Google Docs on chromium.org.
+    if [ -f "$HOME/.gdata_cred.txt" ]; then
+      cp "$HOME/.gdata_cred.txt" "${FLAGS_chroot}/home/${USER}/.gdata_cred.txt"
+    fi
+
     # Make sure user's requested locales are available
     # http://crosbug.com/19139
     # And make sure en_US{,.UTF-8} are always available as