Testable install script

* wraps main code into a function
* EnvVar-based install start
* Clean environment after install
Merge pull request #556 from xcambar/install_function_for_testing

Add install_script test suite; wrap installation in a function, for testing.