factorize install/uninstall scripts