mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 22:12:10 +01:00
enter_chroot: symlink boto config from chromeos-overlay, if available
The private chromeos-overlay has shared credentials for read-only
access to the archive of CrOS images. When entering the chroot check
whether these credentials are available, and install them to ~/.boto
within the chroot unless that file already exists.
BUG=None
TEST=Applied patch and entered fresh private and public chroots.
Manually ran 'gsutil config' to replace the credentials;
this works as long as there is no ~/.boto.bak already.
Re-entered the chroot with manually-configured credentials.
Ran 'gsutil ls' with BOTO_CONFIG set to a board-specific boto.
Change-Id: Ib62dc28f90bce692a833b5fc9d4c56981acc98d1
Reviewed-on: https://gerrit.chromium.org/gerrit/21480
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Chris Wolfe <cwolfe@chromium.org>
Commit-Ready: Chris Wolfe <cwolfe@chromium.org>
This commit is contained in:
parent
db80fc54c9
commit
916b1f1e11
@ -435,6 +435,23 @@ function setup_env {
|
|||||||
if [ -n "$(find "${FLAGS_chroot}/dev/shm" ! -perm 777)" ] ; then
|
if [ -n "$(find "${FLAGS_chroot}/dev/shm" ! -perm 777)" ] ; then
|
||||||
sudo chmod -R 777 "${FLAGS_chroot}/dev/shm"
|
sudo chmod -R 777 "${FLAGS_chroot}/dev/shm"
|
||||||
fi
|
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
|
||||||
|
ln -s "trunk/${boto}" "${FLAGS_chroot}/home/${USER}/.boto"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Have found a few chroots where ~/.gsutil is owned by root:root, probably
|
||||||
|
# as a result of old gsutil or tools. This causes permission errors when
|
||||||
|
# gsutil cp tries to create its cache files, so ensure the user can
|
||||||
|
# actually write to their directory.
|
||||||
|
gsutil_dir="${FLAGS_chroot}/home/${USER}/.gsutil"
|
||||||
|
if [ -d "${gsutil_dir}" ] && [ ! -w "${gsutil_dir}" ]; then
|
||||||
|
sudo chown -R "${USER}:$(id -gn)" "${gsutil_dir}"
|
||||||
|
fi
|
||||||
) 200>>"$LOCKFILE" || die "setup_env failed"
|
) 200>>"$LOCKFILE" || die "setup_env failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user