Refactor IPA scripts

Move configuration script to config/config.sh.

Move common environment setup to lib/env-setup.sh.