Revert "Remove before_install hook"

This reverts commit 22f26d71491db73785400e9cb6bc7d01fd612398.

The hack seems still necessary for 1.8.x.