brew: move to Library/brew.rb

This reverts commit ac156b36d00ead5f225389f0a1d8069d0c1cce4a.
brew: use a shell wrapper script for brew

This reverts commit dfd4dd12a41e1697ee9d5feac12cc1ea7c3a590e.

Fixes the problems from #17683 and #17685.