Index: enter_chroot.sh |
diff --git a/enter_chroot.sh b/enter_chroot.sh |
index 82bd39b1653d5da470ae551754d131816ffe055b..8e3d5898ece2f8ff028146784b5f1ad7b116d774 100755 |
--- a/enter_chroot.sh |
+++ b/enter_chroot.sh |
@@ -302,6 +302,37 @@ function teardown_env { |
) 200>>"$LOCKFILE" || die "teardown_env failed" |
} |
+# This function does extra "fixups" of the chroot. It's a lot like |
+# chroot_hacks_from_outside() in common.sh, except that it is only called |
+# from enter_chroot.sh (chroot_hacks_from_outside is also called from |
+# make_chroot.sh). This function was created because common.sh is on lockdown |
+# and can't be changed. |
+# |
+# NOTE: the need for this type of "fixup" should be going away. If everything |
+# in the chroot is versioned and nothing is generated, there is no need to |
+# handle partly fixing up generated files. |
+# |
+# Please put date information so it's easy to keep track of when |
+# old hacks can be retired and so that people can detect when a |
+# hack triggered when it shouldn't have. |
+function chroot_hacks_too() { |
+ local chroot_home="${FLAGS_chroot}/home/${USER}" |
+ |
+ # Add chromite stuff if not already done. |
+ if ! grep -q "^PATH=.*/trunk/chromite/bin" "${chroot_home}/.bashrc"; then |
+ info "Upgrading old chroot (pre 2011-02-09) - adding chromite to path" |
+ echo "PATH=\$PATH:/home/${USER}/trunk/chromite/bin" >> \ |
+ "${chroot_home}/.bashrc" |
+ fi |
+ if ! [ -L "${chroot_home}/.local/lib/python2.6/site-packages/chromite" ]; then |
+ info "Upgrading old chroot (pre 2011-02-09) - add chromite to site-packages" |
+ mkdir -p "${chroot_home}/.local/lib/python2.6/site-packages" |
+ ln -s ../../../../trunk/chromite \ |
+ "${chroot_home}/.local/lib/python2.6/site-packages/" |
+ fi |
+} |
+ |
+ |
if [ $FLAGS_mount -eq $FLAGS_TRUE ]; then |
setup_env |
info "Make sure you run" |
@@ -318,6 +349,7 @@ fi |
# Apply any hacks needed to update the chroot. |
chroot_hacks_from_outside "${FLAGS_chroot}" |
+chroot_hacks_too |
# Make sure we unmount before exiting |