Revert "revert before_install changes"

This reverts commit 91e791a02ad678b5a49d1b61152a28133be82e47.