Fix chroot bootstrap "no such file or directory" breakage

CL:33868 (7b6f377c581ec6d7170b550bd17f0c1a746a0906) introduced a
breakage in the "cros_sdk --replace --bootstrap" scenario.
The make_chroot.sh script invokes early_enter_chroot before
invoking init_setup.  The chroot/etc/profiles.d directory is
created in init_setup, but the referenced change was
expecting to create a file in that directory in the context
of early_enter_chroot before the directory was created.
This led to a "no such file or directory" error when trying
to create the file.

This change does a "mkdir -p" of the referenced directory
before putting things in it in the context of
early_enter_chroot.  The filename is also fixed to the name
expected elsewhere in the scripts.

BUG=none
TEST=cros_sdk --replace --bootstrap

Change-Id: I6ac0467117d7b0dd413695153469b367d56c256c
Reviewed-on: https://gerrit.chromium.org/gerrit/34958
Commit-Ready: Brian Harring <ferringb@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
This commit is contained in:
Paul Drews 2012-10-08 15:33:43 -07:00 committed by Gerrit
parent 1ef08a9fcf
commit b688cbe4f4

View File

@ -371,9 +371,10 @@ setup_env() {
if [ ! -L "${distfiles_path}" ]; then
# While we're at it, ensure the var is exported w/in the chroot; it
# won't exist if distfiles isn't a symlink.
p="${FLAGS_chroot}/etc/profile.d/chromeos-cache.sh"
p="${FLAGS_chroot}/etc/profile.d/chromeos-cachedir.sh"
sudo_multi "rm -rf '${distfiles_path}'" \
"ln -s chromeos-cache/distfiles '${distfiles_path}'" \
"mkdir -p -m 775 '${p%/*}'" \
"echo 'export CHROMEOS_CACHEDIR=${chroot_cache}' > '${p}'" \
"chmod 0644 '${p}'"
fi