Fixed prepare-commit-msg hook to work on linux.

There were some differences in awk implementation that made it work on
OSX but not on Linux, and vice versa. This version should now work on
both platforms. Also, fixed permissions of some of the hook files.