From 264f64d70b195effb3cc9cd5d343072f6ecf25f0 Mon Sep 17 00:00:00 2001 From: Gilad Arnold Date: Thu, 6 Sep 2012 14:01:45 -0700 Subject: [PATCH] enter_chroot.sh: install /root/.boto symlink for sudoed invocations Since sudo changes $HOME to /root, sudoed invocations of gsutil/boto won't find the necessary credentials. This solves the problem by installing a symlink at /root/.boto to the correct credentials file, similar to how it's done for /home/$USER/.boto. BUG=None TEST=/root/.boto symlink created upon entering the chroot Change-Id: I541556f836fa5d0b9708e5604218058401563fb3 Reviewed-on: https://gerrit.chromium.org/gerrit/32430 Reviewed-by: David James Reviewed-by: Ryan Cui Commit-Ready: Gilad Arnold Tested-by: Gilad Arnold --- sdk_lib/enter_chroot.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index 58cb0f5307..8e764444a0 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -470,11 +470,15 @@ setup_env() { fi # If the private overlays are installed, gsutil can use those credentials. - if [ ! -e "${FLAGS_chroot}/home/${USER}/.boto" ]; then - boto='src/private-overlays/chromeos-overlay/googlestorage_account.boto' - if [ -s "${FLAGS_trunk}/${boto}" ]; then + # We're also installing credentials for use by sudoed invocations. + boto='src/private-overlays/chromeos-overlay/googlestorage_account.boto' + if [ -s "${FLAGS_trunk}/${boto}" ]; then + if [ ! -e "${FLAGS_chroot}/home/${USER}/.boto" ]; then ln -s "trunk/${boto}" "${FLAGS_chroot}/home/${USER}/.boto" fi + if [ ! -e "${FLAGS_chroot}/root/.boto" ]; then + sudo ln -s "../home/${USER}/trunk/${boto}" "${FLAGS_chroot}/root/.boto" + fi fi # Have found a few chroots where ~/.gsutil is owned by root:root, probably