Fix homebrew build script to stop sudo invalidation during install
Patch and restore homebrew patch only when necessary