extract function from both installation script