write and remove hooks upon post-install and post-unistall