add `before_install` and `before_uninstall`
Merge pull request #2742 from rolandwalker/before_install

add `before_install` and `before_uninstall`