Add hook for personalizing chroot.
This places a simple hook in cros_sdk by executing commands
in $HOME/.cros_chroot_init when a chroot is built. This
lets users copy files to the chroot (for instance, scripts), as
well as add lines to .bash_profile and other rc files.
BUG=chromium-os:31295
TEST=tested manually and verified .cros_chroot_init is executed when present
Change-Id: I2a5b070a9827272f7bb7b3d340ad6937b0bef329
Reviewed-on: https://gerrit.chromium.org/gerrit/23668
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 8f402a9..e0ddd0b 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -298,6 +298,10 @@
echo "Copying ~/.gitconfig into chroot"
cp $HOME/.gitconfig "$FLAGS_chroot/home/$USER/"
fi
+
+ if [[ -f $HOME/.cros_chroot_init ]]; then
+ /bin/bash $HOME/.cros_chroot_init "${FLAGS_chroot}"
+ fi
}
# Handle deleting an existing environment.