scripts/hooks functionality added

This is a PR for the postinstall (and more) hooks as mentioned in #249.

One single commit, tests included, rebased on latest.  I included a small bit of documentation in a separate HOOKS.md.  

Let me know if you think anything needs work or updating.  

Thanks.