Refactoring postinstall.sh